ActiveX events in wxPython not working

Perry perry at subdimension.com
Fri Apr 26 07:26:13 EDT 2002


Cliff Wells <logiplexsoftware at earthlink.net> wrote in message news:<mailman.1019763678.16478.python-list at python.org>...
> On 25 Apr 2002 07:25:36 -0700
> Perry wrote:
> 
> > Hi,
> > 
> > I'm using wxPython as an ActiveX (GUI) container. The OCX draws a
> > gantt
> > chart from supplied data. Everything works fine, appart events.
> > 
> > Here is the code:
> 
> [snip]
> 
> > class MyGanttPanel(wxPanel):
> >   def __init__(self, parent):
> >      wxPanel.__init__(self, parent, -1)
> > 
> >      sizer = wxBoxSizer(wxVERTICAL)
> >         
> >      GanttClass = MakeActiveXClass(gchart.VcGantt, eventObj=MyEvents)
> >      gantt.VcGantt = GanttClass(self, -1, wxPoint(0,0), style=wxMAXIMIZE)
>        ^^^^^ Where is this instantiated?
> 
> [snip]
> 
> I don't see where the object "gantt" is being created.  You can't add an
> attribute to a non-existent object:
> 
> Python 2.2 (#1, Mar 15 2002, 11:52:42) 
> [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> f.a = 1 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> NameError: name 'f' is not defined
> >>> class foo: pass
>  ... 
> >>> f = foo()
> >>> f.a = 1
> >>> 
> 
> Are you running the program from a shell or by double-clicking its icon?  It
> may be that there are errors you aren't seeing if you aren't using a shell. 
> Other than that, I'm afraid my ActiveX knowledge is (happily) non-existent, so
> if this isn't your problem then I'm afraid I can't help much.

Solved !!!

Apparently a week ago when I read the doc string in the file
activexwrapper.py i was not paying enough attention. Another trip to this
file solved the problem.

GanttClass = MakeActiveXClass(gchart.VcGantt, eventObj=MyEvents)
                                              ^^^^^^^^
should be:

GanttClass = MakeActiveXClass(gchart.VcGantt, eventClass=MyEvents)


Now everything is working fine. :-)



More information about the Python-list mailing list