Probably A Dumb Python + Gp2x Question


CJ Maynard

Still Fresh
Joined
Jun 24, 2008
Messages
39
Well, I don't have the skill to make games (nor the desire), but I'd like to extend my GP2X with a few python apps I'm working on. I've been reading on pygame and whatnot, which seems like it'd be unnecessary as all I am looking to do is the everyday TKinter display-type stuff. Is there somewhere I can find a beginner guide to python+GP2X programming, geared towards apps not games? My biggest concerns are mapping the buttons and outputting to the screen. Everything else I think I can handle. Much thanks in advance, a search turned up a whole lot of useful info, especially on setting up the environment on the machine, just nothing about using standard, boring python apps :)
 
Hmm...not sure if the build available for gp2x has Tkinter included. It might, I don't have time to confirm one way or the other right now. I suspect that you'd need an X server running.

Either way, the button presses end up in pygame's event handler. I've never tried to access them otherwise and I don't know that you can. See here:
http://wiki.gp2x.org/wiki/SDL_Joystick_mapping#Python

Assuming you sort out things on the GUI end, I'm not sure what's left other than files, etc, which should work the same as any linux system (I think people try to avoid using /tmp on the gp2x, but for small uses it's probably OK).

Sorry I don't have more info, or more definitive info. I've only played around with pygame. On PCs & Macs I've used Tkinter (but not for long, since wxPython beats it in every way :D) but not on GP2X.
 
Thanks dude, that gets me on the right track. I've used TKinter only because the apps I write are super-simple and dedicated, so they haven't needed too much more than that. So it sounds like I still need pygame, at least to handle the screen and button mappings. I can handle that I think :)

Tell you all what...since I am such a python/GP2X noob, maybe I'll try to document my quest so others like me can use the info when I am done. Thanks again for the quick response rokdcasbah!

-CJ
 
No problem. Maybe it would help to see some source. I couldn't remember the names of the gp2x pygame games, but I found them now. You can get a game by Luke Miller called Tunar at the archive:
http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,25,1464

Also there is a game called Catch the Square at the German language forums:
http://forum.gp2x.de/viewtopic.php?f=4&t=5685

Maybe there are more, but those are the ones I know of. Other than setting the screen to 320 x 240, I don't think there's much to know. Obviously you will want to avoid lots of math.sin() & math.cos() :D

I tried to see if I could port one of pymike's simpler games (ninjapix), but it ran very slowly and I don't yet know enough about the language to know what's acceptable in terms of speed and what could have been optimized. I figure when the Pandora comes out I'll have some more clock cycles to burn.


I just realized...you posted this in the general "I need help" forums. It should be in "I need help (dev stuff only)". Maybe a mod can move it so it gets more replies?
 
Lol...I wasn't sure which forum it belonged in best. It's cool if it doesn't get moved, I have a point in the right direction now. Those python apps should definitely help too, thank you again.

I will say, at least for my sake, performance isn't a problem. The apps I want to port are really simple (like 150-300 lines) and just perform basic functions like scheduling and planning, or basic cost calculation for production purposes. So speed isn't too crucial (unless it's REALLY slow). I'll start playing around today and see what I can come up with.

-CJ
 
Back
Top