GestureDrag

class GestureDrag(**properties: Any)

Superclasses: GestureSingle, Gesture, EventController, Object

Subclasses: GesturePan

GtkGestureDrag is a GtkGesture implementation for drags.

The drag operation itself can be tracked throughout the drag_begin, drag_update and drag_end signals, and the relevant coordinates can be extracted through get_offset and get_start_point.

Constructors

class GestureDrag
classmethod new() Gesture

Returns a newly created GtkGesture that recognizes drags.

Methods

class GestureDrag
get_offset() tuple[bool, float, float]

Gets the offset from the start point.

If the gesture is active, this function returns True and fills in x and y with the coordinates of the current point, as an offset to the starting drag point.

get_start_point() tuple[bool, float, float]

Gets the point where the drag started.

If the gesture is active, this function returns True and fills in x and y with the drag start coordinates, in widget-relative coordinates.

Signals

class GestureDrag.signals
drag_begin(start_x: float, start_y: float) None

Emitted whenever dragging starts.

Parameters:
  • start_x – X coordinate, relative to the widget allocation

  • start_y – Y coordinate, relative to the widget allocation

drag_end(offset_x: float, offset_y: float) None

Emitted whenever the dragging is finished.

Parameters:
  • offset_x – X offset, relative to the start point

  • offset_y – Y offset, relative to the start point

drag_update(offset_x: float, offset_y: float) None

Emitted whenever the dragging point moves.

Parameters:
  • offset_x – X offset, relative to the start point

  • offset_y – Y offset, relative to the start point