multithreading and Tkinter

Laura Creighton lac at strakt.com
Thu Mar 21 11:37:39 EST 2002


> Greetings:
> How do I signal the GUI thread that new information for a particular
> object has arrived?  Currently I'm using after() method of the Tkinter
> object to update info for *all* objects every second, but that is
> hardly a good design, since there may be 500 of them, and the new info
> can be arriving once every 15 minutes.
> 
> Any ideas and/or pointers to the documentation (preferably online)
> highly appreciated.

You want to use Queue.Queue() to make yourself a nice incoming
queue, and fill it with the data that arrived and the object(s) that 
care(s) about it.  You'll still use after, but you will only update
the objects that care, and only when something has arrived.  See
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965

Laura Creighton




More information about the Python-list mailing list