import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GObject def on_button_clicked(button): print("Button clicked") button = Gtk.Button(label="Click me") button.connect("clicked", on_button_clicked) GObject.signal_handler_block(button, button.get_signal_handler("clicked")) Gtk.main()This example blocks the "clicked" signal handler for a button and prevents the "Button clicked" message from being printed when the button is clicked. Package Library: The signal_handler_block function is part of the GObject library in the PyGObject package.