Python 2.5 and PyGame running on webOS 2.1

148 views
Skip to first unread message

thp

unread,
May 11, 2011, 9:56:00 AM5/11/11
to Python for webOS
Hi,

I've been playing around with Python (2.5.5) and PyGame (1.9.1) on
webOS (Pre 2 / webOS 2.1) in the last couple of days. I've also
published binaries and build instructions to get Python and PyGame
running on the Pre 2 (the hard work is done by the webOS Internals PDK
- including the initial Python port - thanks to the people involved in
creating that):

http://thp.io/2011/webos/

You can get instructions on how to set up the webOS Internals PDK at:

http://www.webos-internals.org/wiki/WebOS_Internals_PDK

I've tested this with a simple game that I found on the web, searching
for touch-friendly PyGame games. Also, I've written a short example
app that shows how you can access the accelerometer from Python and
how to draw the current accelerometer values to the screen (all linked
from the web page).

One obvious next step would be to write SWIG-generated bindings for
the Plug-in API (for things like PDL_GetLanguage, PDL_GetLocation or
PDL_LaunchBrowser, etc..):

https://developer.palm.com/content/api/reference/pdk/plug-in-api-summary.html

For now, the easiest way to start Python is either via SSH or novaterm
(USB debugging connection). Theoretically it should be possible to
package everything up into a nice .ipk, but that's not a priority for
me right now. I'm also keeping the Python binary + standard library
on /media/internal/ (the interpreter + standard library + PyGame is
about 27MB in size). One idea would be to package Python games as .ipk
and make it depend on having the Python interpreter + library
installed on the internal memory.

Enjoy :)
Thomas

Ezequiel Aceto

unread,
May 11, 2011, 10:05:07 AM5/11/11
to python-f...@googlegroups.com
Thanks great Thomas, nice work. I have been trying to port Python 2.7.1 with not much success, and then put this project on stand-by due to pending jobs.

I will give it a try and when done I will put this on the Google Code project, with examples and and a how-to. I agree with you taht genereting bindings is the next step. Once I have tested and uploaded a small how-to, We can start working together in bindings.

Did you find it fast enough for games? What is your first impression?

Thanks very much

Ezequiel

Thomas Perl

unread,
May 11, 2011, 4:52:55 PM5/11/11
to python-f...@googlegroups.com
Hi,

2011/5/11 Ezequiel Aceto <ezequie...@gmail.com>:


> I will give it a try and when done I will put this on the Google Code project, with examples and and a how-to. I agree with you taht genereting bindings is the next step. Once I have tested and uploaded a small how-to, We can start working together in bindings.

A first version of the Python bindings to PDL is now available.

Binaries: http://thp.io/2011/webos/python-webos_20110511_binary.tar.gz
Source: http://thp.io/2011/webos/python-webos_20110511.tar.gz
Git repository: https://github.com/thp/python-webos

There's also a small example script that demonstrates most of the
webos API and its possibilities. I've tried to keep the API very
pythonic:

http://thp.io/2011/webos/example.py.html

Some of the nontrivial API functions have not been wrapped yet, but
they are marked with "TODO" in the SWIG interface file (webos.i).

> Did you find it fast enough for games? What is your first impression?

For most games that I tried (didn't try too many), it worked fine. I'm
pretty sure it's fast enough for most use cases :)

Enjoy :)
Thomas

Ezequiel Aceto

unread,
May 12, 2011, 7:57:56 AM5/12/11
to python-f...@googlegroups.com
Hello Thomas, how are you? Thanks for getting my idea into a reality, you have done it great.

So you put all the Python stuffs on the SD, and the use SSH to lunch python with a command. If I give you a FTP can you upload the binaries there (Python Interpreter + library + and Pytgame). I will create a Standard SDL project (I have PDK for OS X), check if Python is on the SD Card, if not point out the user where to download it, and if yes, it will launch Python with "main.py" stored in the SDL project.

This way anybody can write python files, boundle it in a simple PDK project and generated a ipk, without needing to build or boundle the entire Python + PyGame into their IPK. Think of having a "Python Enviroment" application in the App Catalog, that when you run it, it checks if you have Python in your SD, if not you get the lastest binaries downloaded. And the you can download "Python games or apps" from the App Catalog, and run it. May be even somebody will make a console program in C++, and you can do python in real-time!

What do you think?

Have a nice day!

.

Thomas Perl

unread,
May 12, 2011, 1:37:51 PM5/12/11
to python-f...@googlegroups.com
Hi,

2011/5/12 Ezequiel Aceto <ezequie...@gmail.com>:


> So you put all the Python stuffs on the SD, and the use SSH to lunch python with a command. If I give you a FTP can you upload the binaries there

All the files are available online and linked from
http://thp.io/2011/webos/ including build instructions, links to the
source and binary packages.

> [...] May be even somebody will make a console program in C++, and you can do python in real-time!

This exists already. Search for "Terminus" or "Terminal" in PreWare.

HTH.
Thomas

Reply all
Reply to author
Forward
0 new messages