How to run functions in the background?

Ognjen Bezanov ognjen at mailshack.com
Mon May 30 21:01:32 EDT 2005


Terry Reedy wrote:

>"Ognjen Bezanov" <ognjen at mailshack.com> wrote in message 
>news:429B3A9E.9060201 at mailshack.com...
>  
>
>>I need to find a way to 'fork' a function into the background yet still
>>be able to send commands to it.
>>    
>>
>
>Others gave you the answer to this..
>
>  
>
>>I am writing a media player, and I have a function which plays the
>>media. I want to be able to run this function but to (at the same time)
>>be able to send commands from it (e.g. pause, play etc...)
>>    
>>
>
>But for this, you might look into PyGame, which, I believe, has functions 
>like this.
>
>Terry J. Reedy
>
>
>
>  
>
I had a look into this, but have decided on pymedia, which was more
focused on well... media.

Either way thanks all of you, I have written my first threaded program,
and it does what I need it to perfectly.

The only thing i have a problem with now is how to communicate with the
thread, I need to send commands such as "play","pause" and the like to
it. someone here mentioned queues, but searching the python
documentation only have me a description of the queue object.

Is there anywhere where I can find out about queues, for people who know
python but have not had a lot of experience with threaded programs? Cheers




More information about the Python-list mailing list