gtk.EventBox — a widget used to catch events for widgets which do not have their own window.
class gtk.EventBox(gtk.Bin): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.EventBox
|
The gtk.EventBox
widget is an invisible container widget that provides a window for widgets
that do not have their own window. In GTK, widgets must have a window to be
able to receive event signals. Those widgets that are "windowless" can use a
gtk.EventBox
to receive event signals.
def get_visible_window()
Returns : | True if the event box window is
visible. |
This method is available in PyGTK 2.4 and above.
The gtk_visible_window
() method returns
True
if the event box has a visible window. See the set_visible_window()
method
for details.
def set_visible_window(visible_window
)
| if True the event box window is
visible. |
This method is available in PyGTK 2.4 and above.
The set_visible_window
() method sets
whether the event box uses a visible or invisible child window according to
the value specified by visible_window
. If
visible_window
is True
the event
box uses a visible child window; otherwise, an invisible child window. The
default is to use visible windows.
In an invisible window event box, the window that that the event
box creates is a gtk.gdk.INPUT_ONLY
window, that is
invisible and only serves to receive events. A visible window event box
creates a visible (gtk.gdk.INPUT_OUTPUT
) window that acts
as the parent window for all the widgets contained in the event box.
You should generally make your event box invisible if you just want to trap events. Creating a visible window may cause artifacts that are visible to the user, especially if the user is using a theme with gradients or pixmaps. The main reason to create a non input-only event box is if you want to set the background to a different color or draw on it.
There is one unexpected issue for an invisible event box that
has its window below the child. (See the set_above_child()
method.) Since the input-only window is not an ancestor window of any
windows that descendant widgets of the event box create, events on these
windows aren't propagated up by the windowing system, but only by GTK+. The
practical effect of this is if an event isn't in the event mask for the
descendant window (see the gtk.Widget.add_events()
method), it won't be received by the event box.
This problem doesn't occur for visible event boxes, because the event box window is actually the ancestor of the descendant windows, not just at the same place on the screen.
def get_above_child()
Returns : | True if the event box window is
above the window of its child. |
This method is available in PyGTK 2.4 and above.
The get_above_child
() method returns
the value of the "above-child" property that indicates whether the event box
window is above or below the windows of its child. See the set_above_child()
method for details.
def set_above_child(above_child
)
| if True the event box window is
above the windows of its child |
This method is available in PyGTK 2.4 and above.
The set_above_child
() method sets the
"above-child" property to the value of
above_child
. If above_child
is
True
, the event box window is positioned above the
windows of its child; otherwise, below it. If the window is above, all
events inside the event box will go to the event box. If the window is
below, events in windows of child widgets will first got to that widget, and
then to its parents. The default is to keep the window below the child.