GestureSwipe

class GestureSwipe(**properties: Any)

Superclasses: GestureSingle, Gesture, EventController, Object

GtkGestureSwipe is a GtkGesture for swipe gestures.

After a press/move/…/move/release sequence happens, the 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, get_velocity can be called in a update handler.

All velocities are reported in pixels/sec units.

Constructors

class GestureSwipe
classmethod new() Gesture

Returns a newly created GtkGesture that recognizes swipes.

Methods

class GestureSwipe
get_velocity() tuple[bool, float, float]

Gets the current velocity.

If the gesture is recognized, this function returns True and fills in velocity_x and velocity_y with the recorded velocity, as per the last events processed.

Signals

class GestureSwipe.signals
swipe(velocity_x: float, velocity_y: float) None

Emitted when the recognized gesture is finished.

Velocity and direction are a product of previously recorded events.

Parameters:
  • velocity_x – velocity in the X axis, in pixels/sec

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