Threaded Tkinter

Michael Muller mike at
Fri Jun 4 10:42:35 EDT 1999

On Thu, 3 Jun 1999 gutier at wrote:

> Hi Michael.
> I just went through your code and tried it out. I think I understand
> what it does now. Thanks for posting it.
> For what I would really like to eventually do (processing network
> activity on a separate thread and updating it on a UI), I still need
> to signal a change in UI from another thread. The poll works but, as
> you obviously know, it is suboptimal. What would be best is if one
> could inject a message into Tk's event queue to cause it to
> immediately call a function, which would read a queue and do
> something.
> I understand there is an "event" command in Tk, but I know nothing
> about it. Do you think it would be helpful?

You can generate custom events under Tkinter, but I think you're going to run
into the same problem with the Tkinter lock: the function that sends the
event is going to block on the Tkinter lock for as long as the main thread
is in the message queue.

>From what I've seen of the Tkinter main loop, there are facilities for
obtaining events from sources other than the window event queue,
unfortunately I don't know how to use them.

michaelMuller = proteus at |
If you are not willing to control your own mind, there are plenty of other
people who are willing to do it for you.

More information about the Python-list mailing list