is there a mouse off (or cursor off) event in wxpython as I need to bind such an event to a panel, making it can automatically store the values input by the user when he is done and click on the other panel. Or is there any other alternative way to make it look nicer without creating uncessary buttons then to bind events to these buttons.
A:
There's EVT_LEAVE_WINDOW which will fire when the cursor goes off the panel.
Or maybe you'd rather use EVT_KILL_FOCUS which will be sent when the panel loses focus (e.g. in your example when the user clicks on another panel or button).
tom10
2010-08-04 03:42:52
If a wx.Panel has any children that can accept focus, it will immediately transfer its focus to the first child that can accept it. So in effect, panels don't really get focus except in rare instances.
Mike Driscoll
2010-08-04 13:33:24
Sure, I just thought I'd mention the option since it seems the OP's use of a panel is a bit unusual in that he wants the panel to "store values input by the user". If the panel has focus and is taking input, EVT_KILL_FOCUS might be useful, though in most circumstance EVT_LEAVE_WINDOW will probably be what he wants.
tom10
2010-08-04 15:30:03
It works! I used the EVT_LEAVE_WINDOW, but to my big suprise that even my cursor was within the panel, travelling around, the event was triggered in an uncertain way when I use a "print" to check, but anyway, it could happen from time to time, particularly when I click on the other panel, that's just the effect I want. Thank you guys!!
ligwin
2010-08-05 10:27:25