January 4, 2023, 6:40pm
I am trying to get the state of a Gtk.ToggleButton in a Gio.SimpleAction. I can toggle it but the state I get is always None. What am I missing here?
search_button = Gtk.ToggleButton(label="Search")
search_action = Gio.SimpleAction.new_stateful("search", None, GLib.Variant.new_boolean(False))
January 5, 2023, 3:38pm
I kinda “solved” it by manually setting the state in the
change-state and then execute my code in the same callback. I do feel this is weird as I would have expected to see the proper state in the
Yes, this is what you have to do, it’s designed this way because you could add some conditional there to make the activation fail.
January 6, 2023, 7:58pm
That seems very odd to me. I can easily update the state in the activate callback if I wanted to.
Anyway, does this apply to all stateful actions?
February 5, 2023, 7:58pm
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.