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

Robin Dunn robin at alldunn.com
Tue Dec 12 12:52:49 PST 2006


Grant Edwards wrote:
> On 2006-12-12, Robin Dunn <robin at alldunn.com> wrote:
>> 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?
> 
> Linux/GTK2 
>   
>   wxPython  2.6.1.0
>   wxGTK     2.6.2-r1
>   gtk+      2.10.6  
> 
>> This sounds vaguely familiar, it may have been a bug I already
>> fixed sometime in the past.

Yes, I think that was either fixed in 2.6.3 or sometime in 2.7.x.


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





More information about the wxpython-users mailing list