MFC application and Python

Adal Chiriliuc hei123 at gamebox.net
Tue May 18 20:37:52 EDT 2004


Hi.

I'm working on a C++ Win32 MFC application and I want to move as much
code as possible to Python.

At first I wanted to use a Python GUI package and keep the critical
components (performance wise) in C++ extensions. The application must
have a native look so this leaves us with only two choices.

wxPython is way too bloated (9 MB on disk, 20MB! in memory for basic
stuff) and people say buggy. PythonWin is nice and small, but lacks
some features, like GDI support.

So this gave me the idea of doing it the other way around: having a
skeleton application which handles Win32 messages and the application
threads and this will call into Python for the logic, which will call
back into C++ for the critical operations and GUI updates.

Since I'm new to Python, can you see any problems with this approach?
Is there a better way to do it?

A specific question: is it ok if C++ calls into Python which calls
into C++ which calls again into Python and so on let's say 5 levels
deep as reaction to a Win32 message or a thread unblocking?

And another one: What are the ways to call into Python? I know of
PyRun_, PyObject_Call and boost::python::call.

Regards,
Adal Chiriliuc




More information about the Python-list mailing list