gtk.EventBox
Prev | The gtk Class Reference | Next

## gtk.EventBox

gtk.EventBox — a widget used to catch events for widgets which do not have their own window.

## Synopsis

    class gtk.EventBox(gtk.Bin):
        gtk.EventBox()
        def get_visible_window()
        def set_visible_window(visible_window)
        def get_above_child()
        def set_above_child(above_child)

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Bin
              +-- gtk.EventBox

## Implemented Interfaces

`gtk.EventBox` implements `gtk.Buildable`

## gtk.EventBox Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"above-child" | Read-Write | If `True`, the event-trapping window of the eventbox is above the window of the child widget as opposed to below it. Available in GTK+ 2.4 and above.
"visible-window" | Read-Write | If `True`, the event box is visible, as opposed to invisible and only used to trap events. Available in GTK+ 2.4 and above.

## gtk.EventBox Style Properties

gtk.Widget Style Properties

## gtk.EventBox Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

## Description

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.

## Constructor

        gtk.EventBox()

Returns : | an eventbox widget

Creates a new `gtk.EventBox` widget.

## Methods

### gtk.EventBox.get_visible_window

        def get_visible_window()

Returns : | `True` if the event box window is visible.

### Note

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.

### gtk.EventBox.set_visible_window

        def set_visible_window(visible_window)

`visible_window` : | if `True` the event box window is visible.

### Note

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.

### Note

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.

### gtk.EventBox.get_above_child

        def get_above_child()

Returns : | `True` if the event box window is above the window of its child.

### Note

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.

### gtk.EventBox.set_above_child

        def set_above_child(above_child)

`above_child` : | if `True` the event box window is above the windows of its child

### Note

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.

Prev | Up | Next
gtk.EntryCompletion | Home | gtk.Expander