Python/Tkinter _and_ COM on win32 platform?

Mark Hammond mhammond at skippinet.com.au
Mon Oct 25 18:56:01 EDT 1999


> My problem is, I have no clue on COM programming. As far as I
> understand, my Python program has to register as a COM server
> providing methods to be called from Delphi.
>
> In the standard libs I found no mention of COM while pythonwin
doesn't
> support Tkinter.

You need the win32all package for COM support, hence no reference in
the core Python documentation - its not in the Python core.

Pythonwin doesnt support Tkinter (or more correctly, Tkinter doesnt
support Pythonwin :-) but that is not relevant to COM - they are quite
seperate.

However, you will have a significant problem getting Delphi to use a
Python GUI.  For one thing, Delphi is almost certainly going to have
the same problem as Pythonwin - Tkinter uses a very non-standard event
loop that is likely to be problematic - eg, Pythonwin can use used
from VB and I guess Delphi (eg, the debugger works fine in these
environments)  Hence my comment that Tkinter doesnt support Pythonwin,
rather than the other way around.

The second problem is that to embed a GUI COM object in Delphi or VB,
you need to conform to the "ActiveX Control" specifications.  Python
does not yet support this part of COM - it very nearly does - the
problem is that ActiveX controls are very complicated, and I havent
had time (nor the inclination, truth be told) to get a sample Python
ActiveX control together.

> I hope there is a way without writing an extension module, that
might
> become a major problem without a C compiler for the win32 platform.

As I mention above about Tkinter and a non-standard event loop, I
think there are other technical reasons why you will have problems.
IIRC, some of the free C++ compilers available are starting to get
good results, so MSVC may not be required these days...

Mark.





More information about the Python-list mailing list