threads problem in python

Astan Chee stanc at al.com.au
Tue May 13 19:46:51 EDT 2008


Sorry, I mean functions not classes. Well, actually, one is a class and 
another is a function. So when the script (its a free game btw) runs, it 
instantiates the first class and somewhere in the middle of processing 
the first class, I need to call a function as a separate thread, I also 
want to wait for the function to complete and I was wondering how python 
handles the thread of this function? Does it die when the function 
completes? Anyway, I know it sounds silly to have 2 threads when I can 
do it with one, but Im using wx to render opengl objects using pygame. 
So it has to be a separate thread, otherwise wx wont play nice. Is there 
a simple example of how I can do this?
And as for finance, the source for the game is free, but it isnt free to 
play on my server. How does that sound?
Thanks
Astan

castironpi at gmail.com wrote:
> On May 13, 5:38 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> wrote:
>   
>> En Tue, 13 May 2008 06:42:13 -0300, Astan Chee <st... at al.com.au> escribió:
>> I'm confused trying to understand your requirements too. "run a class?"
>> Threads execute code, it's easier to think of them as *functions* that are  
>> executed at the same time (or almost).
>> So you have a function A that runs first, and creates a second thread that  
>> will execute function B. Then A will wait for B to finish. What do you  
>> want to do in A while it's waiting? Nothing? Then why to use a second  
>> thread? Or is it a graphical interfase? GUI libraries like wxPython, Qt  
>> and others have specific ways to execute backgroung tasks while keeping  
>> the user interface responsive - you should tell us which one you're using  
>> in that case.
>>
>> --
>> Gabriel Genellina
>>     
>
> I don't mean to be impertinent, but are you making any cents with the
> assignment?  Both free-ers and workers come in here.  I am a free-er
> who has reason to doubt that money-driven programs get stuck at that
> kind of ambiguity.  I hold that money keeps you out of that mess.
>
> However, there are a number of things we can do to help, but as I, per
> se, am only one person, I may not give you the best advice to start
> with.  How do you find the 'threading.py' docs?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>   

-- 
"Formulations of number theory: Complete, Consistent, Non-trivial. Choose two."



Animal Logic
http://www.animallogic.com

Please think of the environment before printing this email.

This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080514/f0ed4545/attachment.html>


More information about the Python-list mailing list