wxShapeEvtHandler

Why can't I get the shape from the wxShapeEvtHandler constructor. Like this:

shape = self.GetShape()

It returns "None". But when I do it from one of the event methods I get the
shape.

It doesn't make sense that I have to get the shape, canvas and diagram in
all of the event methods every time there is an event. They are always the
same and it should be enough to do this once in the constructor...

Cheers,
Thomas

Thomas Aanensen wrote:

Why can't I get the shape from the wxShapeEvtHandler constructor. Like this:

shape = self.GetShape()

It returns "None". But when I do it from one of the event methods I get the
shape.

Because when the wxShapeEvtHandler is created it hasn't had SetShape called on it yet. You could pass the shape into the __init__ and then call self.SetShape from there.

ยทยทยท

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