0

Im using Pyqt4, and I was wondering if it was possible to integrate a Pygame window to a PQT window. Ive been searching the net, and I can only find integration for wxPython, or tkinter.

Something like this:

enter image description here

Im suing Pygame 3 and Python 3.

Thanks in advance!

1
  • Just wondering if you have looked at pygame.org/wiki/gui? On approach would be to create two separate applications that communicate (via UDP, shared memory, XML-RPC, etc), then the "master" would size and position the slave so it looks like they are integrated. Because pygame is based on SDL you might be able to hide the window frame etc, but even if not, it probably wouldn't be too bad. This way the two event loops (qt and game) don't interfere. And python's multiprocessing module should make this easy. Commented Feb 8, 2014 at 14:12

1 Answer 1

1

The page http://pygame.org/wiki/gui this is difficult and if you can, will have severe limitations. That said, I haven't seen how wx and tkinter do it.

But one approach I have seen before is to create two separate applications that communicate (via pipes, UDP, shared memory, XML-RPC, etc), then the "master", probably the Qt GUI, would size and position the slave (pygame app) so it looks like they are integrated. You would make the pygame app borderless. If your qt app is not full screen, and user moves window, you could send command to pygame to hide itself (or minimize or such) when move starts, then once user drops qt app in desired place, update pygame app position.

Python's multiprocessing module should make the IPC straightforward, appear seamless. And this way the two event loops (qt and game) don't interfere, no issues with threading.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.