EventControllerFocus#
Superclasses: EventController, Object
Tracks 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#
Trueif focus is contained in the controllers widget.See
is_focusfor whether the focus is in the widget itself or inside a descendent.When handling focus events, this property is updated before
enterorleaveare emitted.
- props.is_focus: bool#
Trueif 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
enterorleaveare 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_focusproperty 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_focusproperty for changes.