threads with gtk gui problem

andy baxter andy at earthsong.free-online.co.uk
Sat May 14 14:51:37 EDT 2011


On 14/05/11 14:12, Andy Baxter wrote:
> Hi,
>
> I'm working on adding a Gtk GUI to a python program. Its main function 
> is to read raw data from an arduino board over USB, and convert it to 
> MIDI note/controller events to be sent to another program. I've had it 
> working fine with just a command line interface, but when I replaced 
> the command line with a Gtk interface, I started having problems 
> getting the thread that reads the USB port to run.

I've solved this by adding 'import gobject' and 'gobject.threads_init()' 
to the start of the program. Looks like if you don't do this then the 
gtk main loop never releases the python threading lock to other threads.

andy



More information about the Python-list mailing list