CommanderCoder
Posts: 20
Joined: Tue Aug 30, 2011 7:17 am
Contact: Website

Re: Python Libraries

Mon Nov 28, 2011 11:53 pm

I'm working my way through some Python examples which I hope will be enough to attract some apprentice computer scientists. They start with simply finding the factors for the numbers 1 to 50 (some homework my 9 year old son had) and leads onto writing a simulation to thinking about resource management and pushing large amounts of data around.

My main question in recent days has been: which GUI or Rendering support should I use? I've considered Tk, PyGame, wxPython and PyQT (or PySide). Tk was a bit slow (or I was doing it wrong) so I quickly dropped that. The same code in PyGame, wxPython and PyQT seems to perform better.

I've hunted around the Raspberry Pi website and Forum and I've noticed that Qt 5 features prominently. Can I safely assume that PyQT (PySide) will be available on the 'official' Raspberry Pi distro from the start?

Also, a quick note on audio: I've used numpy (will this be available?) to help me generate sound waves that I'm sending to /dev/dsp with ossaudiodev. Is this likely to work on the Raspberry Pi?

I've tried to find out from these forums, but the sheer number of different conflicting discussions is getting hard to follow. Once an 'official' Raspberry Pi OS is available it will be clearer for me to target my examples to the children who want to learn programming. (From the FAQ: "We want to see it being used by kids all over the world to learn programming.")

tntexplosivesltd
Posts: 72
Joined: Fri Sep 30, 2011 8:08 am
Contact: Website

Re: Python Libraries

Tue Nov 29, 2011 12:26 am

I think you'll be pretty safe with Qt, there's heaps of work going into getting it running well on the Raspberry Pi.

User avatar
croston
Posts: 704
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Python Libraries

Tue Nov 29, 2011 8:58 am

I have used most of the frameworks you have listed. Here is my opinion:

Tk
Very old and clunky library and an old way of doing things.

wxPython
Not too bad for developers but I would not teach this to a nine year old beginner because it is a bit clunky. The demos are good though. Not sure about python 3 support.

PyQt/Pyside
These two are almost the same. The differences are
1: The license (GPL vs LGPL) which won't make any difference in an educational setting.
2: PyQt is more mature with good Python 3 support. Pyside only has experimental support for python 3.

You can use Qt designer to 'draw' the GUIs. Although you can do this, the end code is not quite as good (from a perfectionist's point of view) but it is an easy way to get started. Note that with autogenerated code you will not learn as much and you will not have as much control over the final product.

Pygame
Have played with this but never used it for proper looking application software. A good way to go for teaching kids though. See http://inventwithpython.com/

For all of the above it is highly recommended that you use an object oriented approach to your code as this is needed when you get past a certain level. I use PyQt professionally.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24942
Joined: Sat Jul 30, 2011 7:41 pm

Re: Python Libraries

Tue Nov 29, 2011 5:20 pm

I've been meaning to find out about the audio support side. I'll ask around.

I know we have a problem with the AAC licence on the GPU (it's too expensive), so audio support I think will be on the Arm (where you can download it for 'free'), but how you get at it I don't know. Like I said, I'll ask around but in the meantime don't take anything I said above as gospel .
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

CommanderCoder
Posts: 20
Joined: Tue Aug 30, 2011 7:17 am
Contact: Website

Re: Python Libraries

Wed Nov 30, 2011 9:12 pm

That'd be great. I'm looking forward to the official OS and set of Raspberry Pi software. It'll make it so much easier for all children across the country to share their experiences. There is so much chatter on here about what to do with the hardware (a fixed target). It'd be nice to start some chatter about what programs we can develop with a solid software base.

thomas41546
Posts: 10
Joined: Tue Nov 29, 2011 4:04 pm

Re: Python Libraries

Fri Dec 02, 2011 1:22 am

PyGame should be able to run in the framebuffer, since after all PyGame is an SDL wrapper for python. Though, PyQt would be a better choice for GUI applications i'm sure.

darethehair
Posts: 8
Joined: Mon Dec 05, 2011 9:41 pm
Contact: Website

Re: Python Libraries

Mon Dec 05, 2011 11:32 pm

Forgive my ignorance if this has already been answered somewhere else, but what about the PyGTK option? All of the GUI Python apps that I have written (desktop and Nokia Maemo tablets) used PyGTK. It would be nice if they 'just worked' on the R-Pi.

Return to “Staffroom, classroom and projects”