strange Tkinter problem

Alex Martelli aleax at aleax.it
Fri Dec 28 11:00:14 EST 2001


"tjiit" <tjiit at yahoo.com> wrote in message
news:a0baad$vu4$01$1 at news.t-online.com...
> I have an application using a Tkinter GUI which starts a network
> connection if you click on a button. The strange thing is that the GUI
> freezes and the connection is established. Does this mean that Tkinter
> executes the functions bound do an event and then returns when the
> function has ended? I thought it would to kinda multi-threading so it

No!  If threads were generated "behind your back", you'd have a very
hard time handling the resulting mess.

> could handle large events and keep interactive while doing it.
> Can anyone give me a (some) hints?

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965

The Recipe is about the other, harder half of the problem -- a
thread different from the GUI-controlling one wants to talk
with the GUI-thread.  Starting a new thread from the GUI one
(e.g. from a callback: all callbacks run on the GUI thread!)
is easy, with module threading; the problem is coordinating
multiple threads, and the recipe helps with that part.


Alex






More information about the Python-list mailing list