Skip to content

Gtk.GestureClick

class — extends GestureSingle

Recognizes click gestures.

It is able to recognize multiple clicks on a nearby zone, which can be listened for through the GestureClick.pressed signal. Whenever time or distance between clicks exceed the GTK defaults, GestureClick.stopped is emitted, and the click counter is reset.

Constructors

new

@classmethod
def new(cls) -> Gesture

Returns a newly created GtkGesture that recognizes single and multiple presses.

Signals

pressed

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

Emitted whenever a button or touch press happens.

released

def on_released(self, n_press: int, x: float, y: float) -> None: ...

Emitted when a button or touch is released.

n_press will report the number of press that is paired to this event, note that GestureClick.stopped may have been emitted between the press and its release, n_press will only start over at the next press.

stopped

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

Emitted whenever any time/distance threshold has been exceeded.

unpaired-release

def on_unpaired_release(self, x: float, y: float, button: int, sequence: Gdk.EventSequence | None) -> None: ...

Emitted whenever the gesture receives a release event that had no previous corresponding press.

Due to implicit grabs, this can only happen on situations where input is grabbed elsewhere mid-press or the pressed widget voluntarily relinquishes its implicit grab.