Popular recipes by Jacob Hallén http://code.activestate.com/recipes/users/136936/popular/2001-10-21T07:14:35-07:00ActiveState Code RecipesThreads, Tkinter and asynchronous I/O (Python)
2001-10-21T07:14:35-07:00Jacob Hallénhttp://code.activestate.com/recipes/users/136936/http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/
<p style="color: grey">
Python
recipe 82965
by <a href="/recipes/users/136936/">Jacob Hallén</a>
(<a href="/recipes/tags/threads/">threads</a>).
</p>
<p>This recipe shows the easiest way of handling access to sockets, serial ports
and other asynchronous I/O ports while running a Tkinter based GUI.
It allows for a worker thread to block in a select(). Whenever something arrives
it will received and inserted in a queue. The main (GUI) thread then polls
the queue 10 times per second (often enough so the user will not notice any
significant delay), and processes all messages that have arrived.</p>