Exposing object model in Python?

Brian Kelley bkelley at wi.mit.edu
Fri Jun 27 10:37:06 EDT 2003


MK wrote:
> "MK" <MK at foo.com> wrote
> 
> [...]
> 
> Thanks for your input. Apologies for not being clear enough.
> 
> I'm writing a classical desktop application, using wxPython
> and some other libraries. I'm interested to expose its
> object model a la Microsoft's VBA. That is, I want to allow
> my users to tinker with the app, i.e. write their own macros
> in Python in a miniature IDE, within the app. I'd also like to ship
> the program as a standalone app, using py2exe.

First thing, if you don't have Python Programming on Win32 you need to 
purchase it post haste.

Second thing - the problem you are going to find is having COM talk to 
the wxPython application.  wxPython when run, expects to be the main 
thread of execution which means that it is slightly difficult for COM to 
start and talk to wxPython.  I have "solved" this problem using the 
following methodology.

I

COM Server
py2exe wrapped
using windows registry
to keep track of where
GUI executable is
stored.

   ^
   |
   |  Com Server Starts
   |  GUI and connects
   |  through sockets
   |
   V
II

GUI is Threaded and
periodically checks
for commands on the
socket.

Note that the COM Server blocks when sending commands.  This is mainly 
since I don't really understand COM threading.  This shouldn't be too 
much of a problem though.





More information about the Python-list mailing list