Sunday, February 16, 2014

Best Python GUI for Pygame, pgs4a, Android Phones

Simple Game Code and Pygame

Three weeks ago, I wrote about testing PGU with Pygame.  After evaluating it yesterday, I gave up trying to get PGU to work on Android and moved to Sam Bull's Simple Game Code (SGC).  It may be possible, to get PGU to work, but I wasn't able to find anyone using it on Android when I searched through the pgs4a forums.

Sam Bull's code is nice and easy to use and I was able to get several nice menu widgets running on my test LG Optimus S Android phone within an hour.  There's extensive documentation the widgets drop right into a standard pygame code structure.

Radio buttons, switch, slider, and drop down

It's easy to connect the buttons to code to run things in your games.  For example, in the example above, the "Start" button will change the game level, which will run a different set of code.  The "Quit" button will exit the game.  The drop down menu and radio button work fine.

Easy to use text on Pygame surfaces

Running on LG Optimus S Android phone
I'll be doing additional experiments in the future.  In the meantime, I put my experiments for today up on GitHub.

If you end up using SGC on Android, I would be interested in hearing about it and seeing some code examples.

Everyone asks what the "best" library to use is.  It's going to be a matter of taste.  SGC on Android is the best for me and I thought I would share my opinion.   If you have a different opinion, I would like to learn about other GUI toolkits for Python/Android.

Update February 17, 2014
The blog Possibly Wrong has a description of getting PGU working with pgs4a.

I am having problems getting the software keyboard working with SGC InputBox.  I can't get the text to display properly inside of the text input box.  At this point, I'm still planning on using SGC unless I learn something more about PGU to make it worth digging into.



No comments:

Post a Comment