[pygtk] Is a bug in gtk.Menu - Motion/Enter/Leave_Notify Event ???
martin at pycage.de
Thu Mar 4 22:34:21 WST 2004
Am Do, den 04.03.2004 schrieb Martin.Zohlhuber at tttech.com um 15:20:
> I want to make a menubar.deselect() when the mouse leave the application
> (i want avoid, that the popupmenu will still on top, if the user change
> into a other application).
> Problem: When the menu is popup i get only events from this menu.
> I can move the mousepointer around the toplevel window but i get the
> motion event from the menu. When i leave the toplevel window, i get a
> leave event from the menu.
Menu windows grab the mouse pointer globally. Therefore other windows
cannot receive events.
> I think its wrong (bug), because leave the toplevelwindow i shout get the
> event from the window, not from the menu.
The grabbing is not a bug but intentional. That way you can safely click
anywhere on the screen to close the menu without action.
> If it is correct - Why (and how can i solve my problem) ?
If you really need to work around this, then consider implementing your
own menu widget instead of using the one of GTK.
Or you could run a timer that regularly checks if the mouse pointer is
still within the application window (gtk.Window.get_position(),
gtk.Window.get_size()) and close the menu if not.
More information about the pygtk