[wxPython-users] Problem handling mouse-click on subclass of StaticText

Robin Dunn robin at alldunn.com
Mon Dec 11 22:35:11 PST 2006


Grant Edwards wrote:
> I need to handle mouse clicks on StaticText widgets.  I've
> defined this class:
> 
> class ClickableLabel(wx.StaticText):
>     def __init__(self, *args, **kwargs):
>         h = kwargs['handler']
>         del kwargs['handler']
>         wx.StaticText.__init__(self, *args, **kwargs)
>         if h:
>             self.Bind(wx.EVT_LEFT_UP,h)
> 
> However, when the handler calls event.GetEventObject(), the
> ClickableLabel's _parent_ is returned when I expected
> GetEventObject() to return an instance of ClickableLabel.
> 
> How do I find out which ClickableLabel object was clicked?
> 

Which platform and version?  This sounds vaguely familiar, it may have 
been a bug I already fixed sometime in the past.

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





More information about the wxpython-users mailing list