Search code examples
gtksignalspygtkstatetogglebutton

Suppress signal on Gtk.ToggleButton.set_active


Is there a way to suppress the "toggled" signals that is emitted when you set the state of a ToggleButton with set_active()?

I want to represent a connection state with a GtkToggleButton. Since the state can change from other events than just clicking the button, I want to update the button on state-change signals, but I would like the signal not to be emitted (I don't need to run a disconnection procedure when it is already disconnected). I could just check the connection state, but it seems to be inconsistent around the time of the signal.

Other solutions than ToggleButtons are also welcome.

Thanks


Solution

  • See object.handler_block() and friends.