Hello all, I am a self-taught programmer with about 2 years experience and am having a problem trying to launch a pygame program as the last act of a wxPython app. If I explain what I am trying to do and why perhaps someone can help.
I am writing the user interfaces - some wxPython GUIs, some Pygame - for the various 'outstations' on a naval vessel as part of a larger naval simulation. This necessitates comms interfaces with a server.
The model I have used for the wxPython apps is to define a class called 'launch frame' which manages the connection to the server (via a comms thread) and displays the progress: "connecting to server" >> "server connection established"; "establishing role" >> "role established" etc. up to the point where all required data has been received by the 'launch frame'. At this point I am able to 'start' the wxPython 'outstation' and Destroy() the 'launch frame'.
For the Pygame 'outstations' I was hoping to be able to use a sub-class of my 'launch frame' class, keeping all of the comms the same but, obviously, overriding the method which 'starts' the outstation. The problem is How do I start the Pygame program?
I would be most grateful for your suggestions.
Thanks in advance!

Recommended Answers

All 2 Replies

Perhaps use subprocess to make a system call to ./PythonXX/pythonw.exe <path_to_pygame_program> ; there's been a number of threads on here about using subprocess to open pipes to perform certain actions.

thanks jlm699! subprocess.call() does indeed work...but I have to manually kill the wxPython app before the pygame program will launch. Have tried registering a method with atexit which makes the subprocess.call() but still no luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.