Skip to content

Gtk.GesturePan

class — extends GestureDrag

Recognizes pan gestures.

These are drags that are locked to happen along one axis. The axis that a GtkGesturePan handles is defined at construct time, and can be changed through GesturePan.set_orientation.

When the gesture starts to be recognized, GtkGesturePan will attempt to determine as early as possible whether the sequence is moving in the expected direction, and denying the sequence if this does not happen.

Once a panning gesture along the expected axis is recognized, the GesturePan.pan signal will be emitted as input events are received, containing the offset in the given axis.

Constructors

new

@classmethod
def new(cls, orientation: Orientation | int) -> Gesture

Returns a newly created GtkGesture that recognizes pan gestures.

Parameters:

  • orientation — expected orientation

Methods

get_orientation

def get_orientation(self) -> Orientation

Returns the orientation of the pan gestures that this gesture expects.

set_orientation

def set_orientation(self, orientation: Orientation | int) -> None

Sets the orientation to be expected on pan gestures.

Parameters:

  • orientation — expected orientation

Properties

orientation

orientation: Orientation | int  # read/write

The expected orientation of pan gestures.

Signals

pan

def on_pan(self, direction: PanDirection, offset: float) -> None: ...

Emitted once a panning gesture along the expected axis is detected.