Tkinter, main loop question.

Hendrik van Rooyen mail at microcorp.co.za
Thu Nov 23 08:14:54 CET 2006


"Exod" <ratbasher at gmail.com> wrote:


> Don't know if its possible in this light-weight GUI toolset, but can i
> somehow hook up into the mainloop in it, for example if i were to
> create an internet application, i would need to keep recieving data
> from within it?

Its possible - use the call back mechanism to implement a ticker or stutter
thread, remembering that you cant block here, because then the gui stops.

If its a good idea is another question, because sockets wants to be the main
thread too.

but if you fire up another process for the comms, and use threads in front of
pipes, with queues to the ticker in the main loop, it works. Just don't call any
gui stuff from threads in the same process, only from the ticker or stutter
thread.

- Hendrik





More information about the Python-list mailing list