Funny. Solved it myself right after I posted this! ![]()
The secret is to attach a gesture click to the button and set the event state of the gesture click to Gtk.EventSequenceState.CLAIMED:
def __init__(self, *args, **kwargs):
super().__init__(title="Gesture Example", *args, **kwargs)
# ...
self.button = Gtk.Button(label="Click Me")
gesture_click = Gtk.GestureClick.new()
gesture_click.connect("pressed", self.on_button_pressed)
self.button.add_controller(gesture_click)
def on_button_pressed(self, click: Gtk.GestureClick, *args, **kwargs):
print("Button clicked!")
click.set_state(Gtk.EventSequenceState.CLAIMED)