Running a wxWindows application in a wxPython window

Thank you, it looks like that is the best approach.

I could take the entire existing app and make it a dll
with a single start() function and then write a tiny wrapper
which just runs this function.

The requirement was to take an existing app and
turn it into an MDI app by embedding multiple copies of
the app in wxPython MDI frames.

The only concern is that if I have multiple copies of
this function running in separate frames in the same
app what happens to global data in each instance ?

···

---------------------------------------------
Dr Martin Beckett
www.datactics.co.uk
Innovations in Data Matching

Martin Beckett wrote:

Thank you, it looks like that is the best approach.

I could take the entire existing app and make it a dll
with a single start() function and then write a tiny wrapper
which just runs this function.

The requirement was to take an existing app and
turn it into an MDI app by embedding multiple copies of
the app in wxPython MDI frames.

I expect that what you are wanting is to put the contents of your existing app's frame into the MDI child frames, right? In that case you'll want to divide things up a little differently that just a start() function. You won't want the existing app to create the wxApp object or any frames, or etc. So the dividing line should be the point where the content of the frame is created. The new C++ app will still create it's wxApp and frame and will then load the contents of the frame by using code in the DLL, passing the frame to use as a parent window.

The MDI Python app will be sructured similarly. It will create a wxApp, a wxMDIParentFrame, and then for each child window it will make a wxMDIChildFrame and call code in the extension module/DLL for building the content.

The only concern is that if I have multiple copies of
this function running in separate frames in the same
app what happens to global data in each instance ?

There will be a single instance of the DLL and you'll create multiple instances of the classes that implement the frame filling, so you'll need to ensure that no assumptions are made about there being a single instance. The best way to do that is to encapsualte all data within classes and giving each filling window a copy of that data class. Don't use globals. You'll need to adapt accordingly if the multiple instances need to be aware of each other.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!