Gtk.GestureDrag

g GObject.Object GObject.Object Gtk.EventController Gtk.EventController GObject.Object->Gtk.EventController Gtk.Gesture Gtk.Gesture Gtk.EventController->Gtk.Gesture Gtk.GestureSingle Gtk.GestureSingle Gtk.Gesture->Gtk.GestureSingle Gtk.GestureDrag Gtk.GestureDrag Gtk.GestureSingle->Gtk.GestureDrag

Subclasses:Gtk.GesturePan

Virtual Methods

Inherited:GObject.Object (7)

Signals

Inherited:Gtk.Gesture (5), GObject.Object (1)
Name Short Description
drag-begin This signal is emitted whenever dragging starts.
drag-end This signal is emitted whenever the dragging is finished.
drag-update This signal is emitted whenever the dragging point moves.

Class Details

class Gtk.GestureDrag(**kwargs)
Bases:Gtk.GestureSingle
Abstract:No
Structure:Gtk.GestureDragClass

Gtk.GestureDrag is a Gtk.Gesture implementation that recognizes drag operations. The drag operation itself can be tracked throught the Gtk.GestureDrag ::drag-begin, Gtk.GestureDrag ::drag-update and Gtk.GestureDrag ::drag-end signals, or the relevant coordinates be extracted through Gtk.GestureDrag.get_offset() and Gtk.GestureDrag.get_start_point().

classmethod new(widget)[source]
Parameters:widget (Gtk.Widget) – a Gtk.Widget
Returns:a newly created Gtk.GestureDrag
Return type:Gtk.Gesture

Returns a newly created Gtk.Gesture that recognizes drags.

New in version 3.14.

get_offset()[source]
Returns:True if the gesture is active
x:X offset for the current point
y:Y offset for the current point
Return type:(bool, x: float, y: float)

If the self 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.

New in version 3.14.

get_start_point()[source]
Returns:True if the gesture is active
x:X coordinate for the drag start point
y:Y coordinate for the drag start point
Return type:(bool, x: float, y: float)

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

New in version 3.14.

Signal Details

Gtk.GestureDrag.signals.drag_begin(gesture_drag, start_x, start_y)
Signal Name:

drag-begin

Flags:

RUN_LAST

Parameters:
  • gesture_drag (Gtk.GestureDrag) – The object which received the signal
  • start_x (float) – X coordinate, relative to the widget allocation
  • start_y (float) – Y coordinate, relative to the widget allocation

This signal is emitted whenever dragging starts.

New in version 3.14.

Gtk.GestureDrag.signals.drag_end(gesture_drag, offset_x, offset_y)
Signal Name:

drag-end

Flags:

RUN_LAST

Parameters:
  • gesture_drag (Gtk.GestureDrag) – The object which received the signal
  • offset_x (float) – X offset, relative to the start point
  • offset_y (float) – Y offset, relative to the start point

This signal is emitted whenever the dragging is finished.

New in version 3.14.

Gtk.GestureDrag.signals.drag_update(gesture_drag, offset_x, offset_y)
Signal Name:

drag-update

Flags:

RUN_LAST

Parameters:
  • gesture_drag (Gtk.GestureDrag) – The object which received the signal
  • offset_x (float) – X offset, relative to the start point
  • offset_y (float) – Y offset, relative to the start point

This signal is emitted whenever the dragging point moves.

New in version 3.14.