Developing on the NanoNote in Python

From Qi-Hardware
Jump to: navigation, search


The NanoNote firmware comes with the Python script-language pre-installed. Also a number of Python libraries are available, allowing you to create fully-featured applications.

[edit] AlPy

Alpy-demo.png

As of firmware version 2012-04-09, alpy is not installed by default. To install it, type

opkg update
opkg install alpy alpy-examples

AlPy is a Python binding for the Allegro Game Library. Here is example code for loading and drawing an image:

#! /usr/bin/python
From alpy import *

allegro_init()
install_keyboard()

set_color_depth(32)
set_gfx_mode(GFX_SAFE, 320, 240)
b, pal = load_bitmap('IMGP2962.JPG', 'jpg')
b.blit(dest=screen, dest_x=0, dest_y=0)
readkey()

AlPy not only gives you (alpha-shaded and blended) 2-D sprite graphics, it also has support for realtime audio playback and sample mixing, compressed data-files and more. As Allegro is a pretty old game library with roots going back to MS-DOS times, it is very light-weight and fast, perferctly matching the NanoNote's capabilities.

For more Examples see the python examples installed under /usr/share/alpy/examples/, especially the demo game 'demo.py'. To run the demo run

cd /usr/share/alpy/examples && ./demo.py

[edit] AlPy Manual

[edit] Python-Gtk

...todo...

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export