Gtk.GestureSwipe

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.GestureSwipe Gtk.GestureSwipe Gtk.GestureSingle->Gtk.GestureSwipe

Subclasses:

None

Methods

Inherited:

Gtk.GestureSingle (8), Gtk.Gesture (19), Gtk.EventController (5), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (widget)

get_velocity ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gtk.GestureSingle (3), Gtk.Gesture (2), Gtk.EventController (2)

Signals

Inherited:

Gtk.Gesture (5), GObject.Object (1)

Name

Short Description

swipe

This signal is emitted when the recognized gesture is finished, velocity and direction are a product of previously recorded events.

Fields

Inherited:

Gtk.Gesture (5), GObject.Object (1)

Class Details

class Gtk.GestureSwipe(**kwargs)
Bases:

Gtk.GestureSingle

Abstract:

No

Structure:

Gtk.GestureSwipeClass

Gtk.GestureSwipe is a Gtk.Gesture implementation able to recognize swipes, after a press/move/…/move/release sequence happens, the Gtk.GestureSwipe ::swipe signal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.

If the velocity is desired in intermediate points, Gtk.GestureSwipe.get_velocity() can be called on eg. a Gtk.Gesture ::update handler.

All velocities are reported in pixels/sec units.

classmethod new(widget)[source]
Parameters:

widget (Gtk.Widget) – a Gtk.Widget

Returns:

a newly created Gtk.GestureSwipe

Return type:

Gtk.Gesture

Returns a newly created Gtk.Gesture that recognizes swipes.

New in version 3.14.

get_velocity()[source]
Returns:

whether velocity could be calculated

velocity_x:

return value for the velocity in the X axis, in pixels/sec

velocity_y:

return value for the velocity in the Y axis, in pixels/sec

Return type:

(bool, velocity_x: float, velocity_y: float)

If the gesture is recognized, this function returns True and fill in velocity_x and velocity_y with the recorded velocity, as per the last event(s) processed.

New in version 3.14.

Signal Details

Gtk.GestureSwipe.signals.swipe(gesture_swipe, velocity_x, velocity_y)
Signal Name:

swipe

Flags:

RUN_LAST

Parameters:
  • gesture_swipe (Gtk.GestureSwipe) – The object which received the signal

  • velocity_x (float) – velocity in the X axis, in pixels/sec

  • velocity_y (float) – velocity in the Y axis, in pixels/sec

This signal is emitted when the recognized gesture is finished, velocity and direction are a product of previously recorded events.

New in version 3.14.