EventControllerFocus
Superclasses: EventController
, Object
GtkEventControllerFocus
is an event controller to keep track of
keyboard focus.
The event controller offers enter
and leave
signals, as well as
is_focus
and
contains_focus
properties
which are updated to reflect focus changes inside the widget hierarchy
that is rooted at the controllers widget.
Constructors
- class EventControllerFocus
- classmethod new() EventController
Creates a new event controller that will handle focus events.
Methods
Properties
- class EventControllerFocus
- props.contains_focus: bool
True
if focus is contained in the controllers widget.See
is_focus
for whether the focus is in the widget itself or inside a descendent.When handling focus events, this property is updated before
enter
orleave
are emitted.
- props.is_focus: bool
True
if focus is in the controllers widget itself, as opposed to in a descendent widget.See also
contains_focus
.When handling focus events, this property is updated before
enter
orleave
are emitted.
Signals
- class EventControllerFocus.signals
- enter() None
Emitted whenever the focus enters into the widget or one of its descendents.
Note that this means you may not get an ::enter signal even though the widget becomes the focus location, in certain cases (such as when the focus moves from a descendent of the widget to the widget itself). If you are interested in these cases, you can monitor the
is_focus
property for changes.
- leave() None
Emitted whenever the focus leaves the widget hierarchy that is rooted at the widget that the controller is attached to.
Note that this means you may not get a ::leave signal even though the focus moves away from the widget, in certain cases (such as when the focus moves from the widget to a descendent). If you are interested in these cases, you can monitor the
is_focus
property for changes.