batgrl.gadgets.behaviors.focusable#
Focus behavior for a gadget.
Classes
Focus behavior for a gadget. |
- class batgrl.gadgets.behaviors.focusable.AnyFocusedProperty#
Bases:
object
- class batgrl.gadgets.behaviors.focusable.Focusable#
Bases:
object
Focus behavior for a gadget.
Focusable gadgets can be given “focus” by pressing tab or shift + tab or by clicking on them. When a gadget is focused, all focusable ancestors also gain focus.
- Attributes:
is_focused
boolWhether gadget has focus.
- any_focusedbool
Whether any gadget has focus.
Methods
focus()
Focus gadget.
blur()
Un-focus gadget.
focus_next()
Focus next focusable gadget.
focus_previous()
Focus previous focusable gadget.
on_focus()
Update gadget when it gains focus.
on_blur()
Update gadget when it loses focus.
- any_focused: bool = False#
Whether any gadget has focus.
- blur()#
Un-focus gadget.
- dispatch_key(key_event) bool | None #
Dispatch key press only if focused.
- dispatch_mouse(mouse_event) bool | None #
Focus if mouse event is handled.
- focus()#
Focus gadget.
- classmethod focus_next()#
Focus next focusable gadget.
- classmethod focus_previous()#
Focus previous focusable gadget.
- property is_focused: bool#
Whether gadget has focus.
- on_add()#
Add to focusable gadgets and focus on add.
- on_blur()#
Update gadget when it loses focus.
- on_focus()#
Update gadget when it gains focus.
- on_mouse(mouse_event) bool | None #
Focus on mouse down collision and blur otherwise.
- on_remove()#
Remove from focusable gadgets and blur on remove.