Panda3D + Qt4

How can I create both a panda3d window and qt4dialog that run at the same time (from the same script) so that they could communicate with each other?

Should I use threads or something?

p.s. note that I want the windows to be seperate and not panda window as a widget inside qt4 dialog.

Just both of them running from the same script.

Thank youu! :smiley:

Well, I think the standard subprocess module in the Python standard library would be the best solution - see http://docs.python.org/release/2.6.6/library/subprocess.html#module-subprocess.

I don’t know how that works in Qt, but in pyGtk you can just create a Gtk Window alongside the Panda Window and it runs just fine. No need for threads, sub processes and other things only waiting bite your head off. You can put it inside a Gtk Viewport but there’s no such need, it can be a standalone Panda window just as well.

I think that they both create main loops, you can create both windows but they are not usable with default settings.

Maybe there is some way to convert pyQT main loop to panda task?

As I said, I don’t know anything about Qt (although I would expect it to work in a similar way), but in Gtk I’ve just created a loop of my own where I run gtk.main_iteration() and then taskMgr.step(). Someone more competent then me should judge if that’s the right way to do it, but I’ve been using it for my editor with no problems so far, neither from Panda’s side nor from Gtk’s side. Obviously, in my case the Panda window is locked into a GtkViewport, but that doesn’t change anything – it could be a standalone window just the same.

I also found that in order for the GUI to not get locked I need to run it multiple times per loop pass, while running the Panda’s step just once per pass.

I got to all that through trial and error (initially considering threads as well, but I figured they would kill me on the first occasion), so I have no idea if that’s the right way to do it. However, I’m using it with a complex GUI (multiple GTK windows even) and complex scenes running in Panda and I’ve yet to run into any problems, including slowdowns on Gtk or Panda. Thus I think it’s a better approach then messing around with threads or sub processes, which add an enormous amount of complexity and are very difficult to debug.

Again, I’m talking from the point of view of PyGtk. I have no idea if those tricks that I’ve employed will work with PyQt, but I would expect them to.

code is here
pastie.org/2346896

EDIT1:
code above wont quit python properly!

Will that code work with the “official” PyQt4 binding?

Yes, just change import line from pyside to pyqt