BBX Python: Self-contained Demo App

Posted:   |  More posts about PlayBook Python BBPyProject

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 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 Dispay a dialog with "device information" such as PIN and serial number. Dump information about attached displays (LCD and HDMI) to log file. For 6s get screen, navigator, and virtual KB events, output to log file. For 60s get GPS updates and output to log file, with satellite count. For 3.5s blast small bitmap scaled to 1/4 size to screen. Generate several notifications in different styles, one being interactive. Write data from Python "os" package to log file (e.g. PID, current directory). Play a brief WAV file. For 5s randomly flash the screen different colours 25 times per second. 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 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 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.


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.

Comments powered by Disqus