Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ActiveX Controls in Python

1,679 views
Skip to first unread message

David White

unread,
Jun 25, 2001, 12:17:52 AM6/25/01
to
I'm a C++ programmer whose considering using Python to prototype an
ActiveX control. However, I can't seem to find any samples or
resources on implementing ActiveX controls in Python. Would anyone be
able to give me any pointers on how to do it?

Also, the control will have to make heavy use of a grid control, what
grid controls are available that have Python interfaces?

Help would be appreciated.

David White
Programmer
WebLink Pty Ltd

Paul Brian

unread,
Jun 25, 2001, 6:47:35 AM6/25/01
to
Python has some very good COM interfaces, written by Mark Hammond and
detailed well here:
http://www.python.org/windows/
http://starship.python.net/crew/mhammond/
Avaialble here:
http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all

Basically, pyhton is able to act as a COM server and client depending on the
choice of module you import from Win32All...its incredibly simple - honest.

cheers
pbrian

David White <dav...@weblink.com.au> wrote in message
news:4dfd15be.01062...@posting.google.com...

Bill Bell

unread,
Jun 25, 2001, 11:07:54 AM6/25/01
to pytho...@cwi.nl, David White

dav...@weblink.com.au (David White) wrote:
> I'm a C++ programmer whose considering using Python to prototype an
> ActiveX control. However, I can't seem to find any samples or
> resources on implementing ActiveX controls in Python. Would anyone be
> able to give me any pointers on how to do it?
>
> Also, the control will have to make heavy use of a grid control, what
> grid controls are available that have Python interfaces?

David, your message reminded me that Mark Hammond, one of the main, if
not the main expert on this topic wrote, "Python's COM support does not
support fully-fledged controls. The win32comext/axcontrol directory is
the start of work in this direction, and supports many of the interfaces
needed." I googled to find that he wrote that about 6 May (and you
might want to read the rest of that thread). I'm curious about what your
control will do. Would it be possible to say? - Bill

Bill Bell, Software Developer

David White

unread,
Jun 25, 2001, 7:29:55 PM6/25/01
to
"Bill Bell" <bill...@bill-bell.hamilton.on.ca> wrote in message news:<mailman.993481937...@python.org>...

> dav...@weblink.com.au (David White) wrote:
> > I'm a C++ programmer whose considering using Python to prototype an
> > ActiveX control. However, I can't seem to find any samples or
> > resources on implementing ActiveX controls in Python. Would anyone be
> > able to give me any pointers on how to do it?
> >
> > Also, the control will have to make heavy use of a grid control, what
> > grid controls are available that have Python interfaces?
>
> David, your message reminded me that Mark Hammond, one of the main, if
> not the main expert on this topic wrote, "Python's COM support does not
> support fully-fledged controls. The win32comext/axcontrol directory is
> the start of work in this direction, and supports many of the interfaces
> needed." I googled to find that he wrote that about 6 May (and you
> might want to read the rest of that thread).

I read the rest of the thread - and it seemed to indicate that
extending the support for ax controls wouldn't be *too* difficult.
However, I doubt I'd have time to do this. (convincing my boss to give
me time to extend Python in win32 when I'm meant to be writing a
C++/win32 application would be difficult to say the least!)

> I'm curious about what your
> control will do. Would it be possible to say? - Bill

I can't say too much about it, but basically it's a hierarchial grid,
with data being streamed into the grid from a server, and the user
being able to analyse and perform calculations on the data. I would
likely leave the server-connection bit out of the prototype, and just
use canned data. However, I'd want everything else to look as close to
possible as the final C++ implementation will be, as the main reason
I'm doing the prototype is because my boss has a penchant for
requesting whole series of "minor" changes to the user interface that
each take a couple of days to implement.

I'm really hoping I can do the prototype in Python, because I don't
want to even think about touching Visual Basic.

Courageous

unread,
Jun 26, 2001, 2:14:05 AM6/26/01
to

>(convincing my boss to give
>me time to extend Python in win32 when I'm meant to be writing a
>C++/win32 application would be difficult to say the least!)

While I'm sure every situation differs, one truth I've found
over the years: do not convince, PRODUCE.


C//

Bill Bell

unread,
Jun 26, 2001, 11:29:25 AM6/26/01
to pytho...@cwi.nl, David White, Carlos Ribeiro

dav...@weblink.com.au (David White) wrote, in part:
> I'm really hoping I can do the [hierarchial grid] prototype in

> Python, because I don't want to even think about touching Visual
> Basic.

I ~know~ whatcha mean!

What would you think of the following:

1. Use MSVC to create a series of "HTML Control" ActiveX thingys
(one item in the series for each time your boss changes his/her
mind)--it's relatively easy to play with HTML/JScript.

---

The ActiveXWrapper_IE.py code in the wxPython demo says, "The
MakeActiveXClass function dynamically builds a new Class on the
fly, that has the same signature and semantics as wxWindow."

---

2. So host the ActiveX in Python code written with the aid of
wxPython.

Overall, make C++ code in the ActiveX as simple as possible and
favour development in Python.

This topic interests me and I'd value your opinion.

David White

unread,
Jun 26, 2001, 10:49:44 PM6/26/01
to
"Bill Bell" <bill...@bill-bell.hamilton.on.ca> wrote in message news:<mailman.993569620...@python.org>...

> dav...@weblink.com.au (David White) wrote, in part:
> > I'm really hoping I can do the [hierarchial grid] prototype in
> > Python, because I don't want to even think about touching Visual
> > Basic.
>
> I ~know~ whatcha mean!

[snip]

>
> 2. So host the ActiveX in Python code written with the aid of
> wxPython.

I must admit that I'm not terribly familiar with Python's windows
extensions, and so I'm not sure I understand your solution properly.
Please correct me if I say something that betrays a
misunderstanding...

The main problem I see is that I was planning to use MFC directly, not
wxWindows. I'm not very familiar with wxWindows, but I understand it's
interface is very different from that of MFC, and that it can't do
some things MFC can do, as it is a portable library, and can only
supply the common subset of functionality that is available on various
platforms. Is this correct?

Since I'll be doing the final product using MFC, I was hoping to do
the prototype using Python's MFC bindings; also, I haven't used
wxWindows before, and time is going to be quite an issue - so it'd be
better to use MFC due to my familiarity with it.

David White
Programmer
Weblink Pty Ltd

Robin Dunn

unread,
Jun 27, 2001, 1:27:02 AM6/27/01
to
> I'm not very familiar with wxWindows, but I understand it's
> interface is very different from that of MFC, and that it can't do
> some things MFC can do, as it is a portable library, and can only
> supply the common subset of functionality that is available on various
> platforms. Is this correct?

Yes and no. wxWindows may not have all the classes/controls/widgets that
MFC does, but it is not because of common subset issues. (Although all the
commonly used things are there.) MSW is the reference platform for
wxWindows, meaning that most things are implemented there first, and that
the MSW way of doing things is often reflected in the API. Where certain
features are not available in other platforms then they are usually
implemented genericly for the other platforms using wxWindows.

Overall a MFC programmer will probably find wxWindows to feel very familiar,
but in general easier to use.


--
Robin Dunn
Software Craftsman
ro...@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Bill Bell

unread,
Jun 27, 2001, 7:28:10 PM6/27/01
to pytho...@cwi.nl, David White

dav...@weblink.com.au (David White) wrote, in part:

> "Bill Bell" <bill...@bill-bell.hamilton.on.ca> wrote in message


> > 2. So host the ActiveX in Python code written with the aid of
> > wxPython.

I haven't responded to your first question about wxPython's
functionality as compared with that of MFC because I believe that
Robin Dunn has already done so.

> Since I'll be doing the final product using MFC, I was hoping to do
> the prototype using Python's MFC bindings; also, I haven't used
> wxWindows before, and time is going to be quite an issue - so it'd be
> better to use MFC due to my familiarity with it.

What I was suggesting ~might~ have been useful as a prototype
for use in elliciting feedback from users and to a much less degree
understanding the techniques that would be needed. However, it
appears to me that you might want to make a series of versions
that start with Python driving MFC and culminate in C++ driving
MFC. In that case, I think you're probably right.

Good luck!

Bill

0 new messages