Skip to content

Gtk.GestureLongPress

class — extends GestureSingle

Recognizes long press gestures.

This gesture is also known as “Press and Hold”.

When the timeout is exceeded, the gesture is triggering the GestureLongPress.pressed signal.

If the touchpoint is lifted before the timeout passes, or if it drifts too far of the initial press point, the GestureLongPress.cancelled signal will be emitted.

How long the timeout is before the ::pressed signal gets emitted is determined by the Settings.gtk-long-press-time setting. It can be modified by the GestureLongPress.delay-factor property.

Constructors

new

@classmethod
def new(cls) -> Gesture

Returns a newly created GtkGesture that recognizes long presses.

Methods

get_delay_factor

def get_delay_factor(self) -> float

Returns the delay factor.

set_delay_factor

def set_delay_factor(self, delay_factor: float) -> None

Applies the given delay factor.

The default long press time will be multiplied by this value. Valid values are in the range [0.5..2.0].

Parameters:

  • delay_factor — The delay factor to apply

Properties

delay_factor

delay_factor: float  # read/write

Factor by which to modify the default timeout.

Signals

cancelled

def on_cancelled(self) -> None: ...

Emitted whenever a press moved too far, or was released before GestureLongPress.pressed happened.

pressed

def on_pressed(self, x: float, y: float) -> None: ...

Emitted whenever a press goes unmoved/unreleased longer than what the GTK defaults tell.