pymedia and panda3d

I have making a game in which there is audience interaction. In this there will be a microphone input which will detect the singing of the audience. This is done using pymedia. However, when I start running the sound program on its own, it works well. But when it is ran with panda, the game does not start at all. The pymedia keeps on running. When I replace the pymedia code and run it later in the program, it halts the panda3d program and then executes. Is there a way by which I can run both of them in parallel.
I also tried doing this using the Snack module. But for snack I am unable to stop it from showing its GUI (i.e Tkinter window). Please let me know the solution of this problem
Thank you in advance

You probably have a problem having 2 different “game loops.” You need to either remove panda3d’s game or pymedia’s and call a step function of the other in the one you decide to keep.

This page explains a bit more about merging game loops:

or you fire up 2 seperate processes and use sockets to communicate between them- its a little bit ugly but if you know how to use sockets already its yet another possibility.

Even i thought about the sockets. But i am not familiar with using sockets in python. What is more solid to work on as i have limited time to make it working??
And that was quite a quick reply. Thank you all.

I really do not recommend using sockets for this. That would be wayy overkill. The solution is much easier.

By the way, Panda3D already supports the main loop for wx and tk. For example you can put this in your Config.prc:

want-tk #t

Alternatively, you can use this code to start the Tk main loop:


That makes sure one main loop won’t block the other.

If you are using some other package, you can do one of:
(1) Find some way to step through the mainloop of the other package. Then add that as task.
(2) If it doesn’t have a step method, then do it the other way around. Add taskMgr.step to the main loop of the other package.