About Embedding PyWin or wxPython

Mr. Roboto mr.roboto.ny at gmail.com
Mon Jul 24 20:58:07 EDT 2006


Folks:  I want to embark on a project to add Python (actually, wxPython
or PythonWin) to a new Windows app I want to start writing soon.
Essentially, I want to take VB6 (or pos Delphi) and construct the app
framework/core functionality using one of those languages, then extend
the app w/ Python, the same way one can extend the MS Office apps
using VBA.  The core Python docs provide the fundamental info one
needs to get started.  But, I've been looking for some pointers to
articles/web pages that will bootstrap the effort, so I won't have to
completely reinvent the wheel.  So far, the c.l.p ngroup traffic (and
the web in general) that speaks to this subject is apparently pretty
sparse.  Since I'm a one-man show, it would be helpful if anyone could
offer pointers to sites/pages/books that address some of these issues:

1)  To COM or not ?  From an implementation standpoint, it seems
worthwhile to build the host app as a series of COM objects, which
could then be ref'd/manipulated via external Python code.  Not sure if
this makes sense from a performance-perspective, but I doubt the apps
I'm thinking about (mostly desk accessory utils kinda, sorta) are
going to be compute-intensive at all.

2)  SWIG or not ?  Have never used it, but know that SWIG has been
ref'd many times in the ngroup as an tool for facilitating the use of
Python as an embedded language.  Is SWIG worth the effort for a
relatively small (<10 KLOC) app ?

3)  Handling exceptions.  I want to start from Day One with a sensible
approach to debugging and testing both host objects and external
scripts.

4)  Deployment.  Size (30 - 50MB for wxPython or PyWin alone) and a
silent install of either pkg prior to installing the host app.

Regardless of the conversation in this group, I plan to get started in
the next few days.  This is how I'm currently looking at the above
issues:

1)  COM:  Yes, since COM seems like an easy fit w/o writing lotsa
glue code because of built-in support via PyWin

2)  SWIG:  Not for a 1st cut, at least not to get one's feet wet, so
to speak

3)  Exceptions:  No clue.  Need to closely read Extending/Embedding
Python for more guidance

4) Deployment: Bite the disk space bullet and use PyWin or wxPython as
is

Anyway, that's the beginning of the conversation.  If you have any
observations or suggestions, please feel free.  Later...MR




More information about the Python-list mailing list