python threading

Boudewijn Rempt boud at valdyas.org
Tue Apr 16 11:10:45 EDT 2002


Steve Holden wrote:

> "sameer" <sameer_ at email.com> wrote ...
>> I am trying to run multiple threads in a wxFrame class to instantiate
>> different panels within it on Win 2k,  and well, it's a little hairy.
>> Anyone got a good web source that discusses python threading in depth?
>>
>> More so, my question is, how can I get the return value of a function
>> that I run on a seperate thread?  I don't see anything for this in the
>> threading module.
> 
> The canoncial reference was written by Aahz, whe keeps threatening to
> update it. See
> 
>     http://starship.python.net/crew/aahz/OSCON2001/index.html
> 
> The Queue module might help you with passing values between threads, as
> it's specifically designed to be thread-safe.
> 

That's funny -- only yesterday this cropped up too, and Alex Martelli sent
me a link to: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965,
where I quickly added a PyQt version of the example code... It uses Queue. 
Actually instantiating GUI objects from different threads might be hard. I 
would place instantiation requests on the Queue, and have the GUI thread
execute them.

-- 
Boudewijn Rempt | http://www.valdyas.org



More information about the Python-list mailing list