Reputation: 4548
I created a menubar using the Python bindings for GTK3 and Gio.Action
instead of Gtk.Action
, similar to how it is described in this answer.
But now I'm having trouble trying to dynamically set the sensitivity of a menu item (whether it is greyed out). Gtk.Action
provides a simple set_sensitive
method, but I can't find a clean way of getting the Gtk.Action
associated with my Gio.Action
. Gtk.Application
only has methods for directly getting the Gio.MenuModel
s, not the Gtk.Menu
, for instance.
Upvotes: 1
Views: 470
Reputation: 2302
Gio.SimpleAction.set_enabled()
action = Gio.SimpleAction.new('my-action', None)
action.set_enabled(False) # This makes it insensitive
Upvotes: 1