I need to reuse a C++ wxWindows application inside wxPython.
I thought I could rebuild the app as a dll without the wxApp() class
and pass in the parent wxPython frame into the wxFrame ctor.
A couple of questions,
1, How do I pass a wxWindow object into a C init function,
the docs only describe objects for which there is PyArg_Parse
function.
2, Where in the wxPython source should I look for examples
most of it is generated by SWIG and so not that easy to follow.
I need to reuse a C++ wxWindows application inside wxPython.
I thought I could rebuild the app as a dll without the wxApp() class
That's the first step. The second step is to create a Python extension module that exposes some of the functions in the dll to Python, (whatever you want to be able to call from Python code.) See the Python Extending and Embedding manual for the basics of what is required for that.
and pass in the parent wxPython frame into the wxFrame ctor.
A couple of questions,
1, How do I pass a wxWindow object into a C init function,
the docs only describe objects for which there is PyArg_Parse
function.
2, Where in the wxPython source should I look for examples
most of it is generated by SWIG and so not that easy to follow.
3, Is there anything else to look out for ?
Take a look at wxPython's embedding sample and notes, as most of the things needed to do embedding will also apply to your extension module. Specifically, your extension code will need to include wxPython.h and call wxPyCoreAPI_IMPORT to import a structure of function pointers from the wxPython extension. You'll then be able to use the API provided by those fucntions to properly handle the global interpreter lock and also to typecheck and convert PyObject pointers into wxWindow pointers, etc.
One of these days I need to document that API, but I think that the code and comments in the wxPython embedding sample should be enough to put you on the right track.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!