[pygtk] Updating widgets within threads

John Finlay finlay at moeraki.com
Fri Sep 4 22:58:29 WST 2009


Bottiger, Maxwell - AES wrote:
> Hi,
>
> I have an implementation methodology question.  I'm putting together an app which runs a bunch of external devices.  All my devices are on different serial ports and run at different frequencies.  I'd like to use one thread to monitor each device, then have the thread update it's relevant section of the GUI.  I've been playing with updating a progress bar with a thread this morning and I've found once I start the thread the main window freezes until the thread completely exits.
>
> Obviously this isn't working.  What is the best way to go about this?  I don't want to freeze my main window by putting sleep calls in the main loop, but I do need to update the display when new data becomes available.
>
>   
Have you considered using using gobject.io_add_watch() instead of using 
threads? Unless there is some really long calculation this would seem 
like an ideal event driven program.

John


More information about the pygtk mailing list