multithreading and Tkinter
Cameron Laird
claird at starbase.neosoft.com
Fri Mar 22 09:41:14 EST 2002
In article <mailman.1016728725.9585.python-list at python.org>,
Laura Creighton <lac at strakt.com> wrote:
>> 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
>
Excellent advice from both Laura and Aahz.
There's been very casual chatter among Tk insiders about
(in Tkinter-speak) making update a method of individual
widgets. It definitely doesn't exist now, it appears to
require guru-level concentration, and we're still not
sure it's even feasible in some appropriate sense;
however, I think it's worth alerting readers of this
thread that there's a possibility of an interesting
enhancement in the indefinite future.
--
Cameron Laird <Cameron at Lairds.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html
More information about the Python-list
mailing list