Ognjen Bezanov wrote: > > 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
Queues take most of the hassle out of thread programming. You need to come up with an object that encapsulates all the commands you may need. In your case, it sounds like a string is all you'll need. The thread with the player periodically monitors the queue for commands with Queue.get, and your other thread occasionaly sends commands by putting them on the queue with Queue.put. If the queue is the only point of contact between your threads (ie they dont share data), then you should find it a breeze to set up. Will -- http://www.willmcgugan.com "".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in "jvyy*jvyyzpthtna^pbz") -- http://mail.python.org/mailman/listinfo/python-list