[wxpython-users] Catching user leaving the window

Robin Dunn robin at alldunn.com
Mon Sep 8 12:33:23 PDT 2008


Werner F. Bruhin wrote:
> Werner F. Bruhin wrote:
>> ...
>>>
>>> Did you try EVT_LEAVE_WINDOW ? I would think that would work no 
>>> matter which widget you're using, unless the OS doesn't support it.
>> I tried this but no luck (Windows, Python 2.5.2, wxPython 2.8.8.1 
>> Unicode)
>>
>> Will have to do a small sample app to make sure that it is not 
>> something I do in my app.
> Seems like FlatNotebook doesn't do any mouse events.
> 
> Tried:
>        self.flatNotebook1.Bind(wx.EVT_LEAVE_WINDOW,
>              self.OnFlatNotebook1LeaveWindow)
>        self.flatNotebook1.Bind(wx.EVT_KILL_FOCUS,
>              self.OnFlatNotebook1KillFocus)
>        self.flatNotebook1.Bind(wx.EVT_ENTER_WINDOW,
>              self.OnFlatNotebook1EnterWindow)
>        self.flatNotebook1.Bind(wx.EVT_MOUSE_EVENTS,
>              self.OnFlatNotebook1MouseEvents)
>        self.flatNotebook1.Bind(wx.EVT_MOTION, self.OnFlatNotebook1Motion)
>        self.flatNotebook1.Bind(wx.EVT_RIGHT_DOWN,
>              self.OnFlatNotebook1RightDown)
> 
> None of them fire.
> 
> Is this intended?  

Yes.  The mouse events fire when the cursor is over an exposed portion 
of the window, but in the case of the FlatNotebook there is no part of 
it that is exposed.  The page windows cover all except for the tabs, and 
the tabs area is implemented by another sub window (the PageContainer 
class) so there is nothing left of the FlatNotebook that can even see 
the mouse.



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



More information about the wxpython-users mailing list