Threaded Tkinter

Michael Muller mike at proteus.dialup.cloud9.net
Fri Jun 4 16:55:31 CEST 1999


On Thu, 3 Jun 1999 gutier at intergate.bc.ca wrote:

> 
> Hi Michael.
> 
> Thanks for the suggestion.
> 
> I had been mulling over the idea of somehow getting the Tk event loop
> to periodically call a method of mine which would read a queue and do
> what's needed. Would the lock you describe interfere with this in any
> way? If not, how do I go about injecting messages into the Tk event
> loop?
> 
> Also, as you can guess I know little about Tk. Where is the event loop 
> in the code you provided below? Does the tk.after() call look at Tk's
> event loop and perform necessary actions?
[snip]

I omitted the event loop call in this example.  Add the line:

   tk.mainloop()

This is the standard event loop, and it will continue to process events
until the application is terminated.

tk.after() creates a "timer"; the event handler subsequently reacts to the
timer and calls the function at the appropriate time.

=============================================================================
michaelMuller = proteus at cloud9.net | http://www.cloud9.net/~proteus
-----------------------------------------------------------------------------
Mantra for the 60's: Tune in, turn on, drop out
Mantra for the 90's: Turn on, jack in, jerk off
=============================================================================





More information about the Python-list mailing list