Python Threads

Gabriel Genellina gagsl-py at yahoo.com.ar
Sun Feb 18 23:38:48 EST 2007


En Sun, 18 Feb 2007 23:37:02 -0300, Sick Monkey <sickcodemonkey at gmail.com>  
escribió:

> Well if this cannot be done, can a thread call a function in the main
> method?
> I have been trying and have not been successive.  Perhaps I am using  
> thread
> incorrectly.

The safe way to pass information between threads is to use Queue. From  
inside the working thread, you put() an item with enough state  
information. On the main (GUI) thread, you use after() to check for any  
data in the queue, and then update the interfase accordingly.
I think there is a recipe in the Python Cookbook  
http://aspn.activestate.com/ASPN/Cookbook/Python

-- 
Gabriel Genellina




More information about the Python-list mailing list