Earlier today I wrote about how it turns out that the Tablet OS (2.0.0 beta or later) actually recognizes Python as a direct "entry point" for apps, as it does for apps built using AIR or the Native SDK (WebWorks apps use the AIR entry point at this time).
With the original crude launcher, we'd developed a small set of experiments and demonstration scripts, which you had to copy over the network to "documents/scripts", with the bbxrun.py file sitting above to let you select which one to run.
I've taken the whole mess and packaged it up using the new approach, with a signed .bar file up so you can try it out for yourself if you'd like. (Download link is at the end of this post.)
Some of the demo scripts are purely experimental or proofs-of-concept, without even a visible UI (except a blank screen) while they run. Some do something visible in the UI or interact in other ways. Following is a brief description of each.
Name | Description |
deviceinfo.py | Dispay a dialog with "device information" such as PIN and serial number. |
display_info.py | Dump information about attached displays (LCD and HDMI) to log file. |
event_test.py | For 6s get screen, navigator, and virtual KB events, output to log file. |
geotrace.py | For 60s get GPS updates and output to log file, with satellite count. |
image_test.py | For 3.5s blast small bitmap scaled to 1/4 size to screen. |
notifications.py | Generate several notifications in different styles, one being interactive. |
os_info.py | Write data from Python "os" package to log file (e.g. PID, current directory). |
play_sound.py | Play a brief WAV file. |
psychedelic.py | For 5s randomly flash the screen different colours 25 times per second. |
python_info.py | Write data from Python "system" package to log file (e.g. version, path). |
The log file the demo app writes to is the usual in-sandbox file (under logs/log) but once you exit the app using the Cancel button it copies it to documents/ca.microcode.bbxpython.demo.log so you can view it on your computer. (It should be possible to respond to the NAVIGATOR_EXIT event by doing the same thing in a later update.)
I should be able to include the font_test.py demo in a few days after I get a chance to refactor and optimize it a bit.
The demo app is available in the downloads folder as bbxpython-demo-x.x.x.x.bar with whatever version it happens to be at when you download it.
Source code code is in the blackberry-py bitbucket repository, or you could just look in the .bar file since this version doesn't use compiled bytecode, but .py source files.
Future updates won't result in this page changing... I'll start including in-app documentation and/or a separate page in the wiki where it can more easily be maintained.
As usual, follow the news on Twitter using hash tag #bbx-python or follow me at @peter9477.
Note
As of June 2012, we've renamed this the BlackBerry-Py Project. You can follow news about it at @BBPyProject and the web site has moved too.