batgrl.gadgets.behaviors.movable#

Movable behavior for a gadget.

Classes

Movable(*[, disable_oob, ...])

Movable behavior for a gadget.

class batgrl.gadgets.behaviors.movable.Movable(*, disable_oob=False, allow_vertical_translation=True, allow_horizontal_translation=True, is_grabbable: bool = True, ptf_on_grab: bool = False, mouse_button: Literal['left', 'middle', 'no_button', 'right'] = 'left', **kwargs)#

Bases: Grabbable

Movable behavior for a gadget.

Translate a gadget by clicking and dragging it.

Parameters:
disable_oobbool, default: False

Whether the gadget must be contained in its parent’s bounding box.

allow_vertical_translationbool, default: True

Allow vertical translation.

allow_horizontal_translationbool, default: True

Allow horizontal translation.

is_grabbablebool, default: True

Whether grabbable behavior is enabled.

ptf_on_grabbool, default: False

Whether the gadget will be pulled to front when grabbed.

mouse_buttonMouseButton, default: “left”

Mouse button used for grabbing.

Attributes:
disable_oobbool

Whether the gadget must be contained in its parent’s bounding box.

allow_vertical_translationbool

Allow vertical translation.

allow_horizontal_translationbool

Allow horizontal translation.

is_grabbablebool

Whether grabbable behavior is enabled.

ptf_on_grabbool

Whether the gadget will be pulled to front when grabbed.

mouse_buttonMouseButton

Mouse button used for grabbing.

is_grabbedbool

Whether gadget is grabbed.

Methods

grab(mouse_event)

Grab the gadget.

ungrab(mouse_event)

Ungrab the gadget.

grab_update(mouse_event)

Update gadget with incoming mouse events while grabbed.

grab(mouse_event: MouseEvent)#

Grab gadget.

Parameters:
mouse_eventMouseEvent

The mouse event that grabbed the gadget.

grab_update(mouse_event)#

Translate movable on grab update.

property is_grabbed: bool#

Whether gadget is grabbed.

on_mouse(mouse_event)#

Determine if mouse event grabs or ungrabs gadget.

ungrab(mouse_event: MouseEvent)#

Ungrab gadget.

Parameters:
mouse_eventMouseEvent

The mouse event that ungrabbed the gadget.