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!
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