How to enable / disable toolbar items?

How did you disable gtk.ToolButton so that it is grayed out? Like this:

alt text

How do you turn it on again?

+7
python gtk pygtk toolbar
source share
1 answer

Use the set_sensitive method. If you only need to disable / enable the button, you must call the method on the button; the argument must be True to enable and False to disable:

 button.set_sensitive(True) # enables the button button.set_sensitive(False) # disables the button 

If you are dealing with actions, you can disable / activate the action associated with the button (this ensures that other widgets that can be associated with the same actions, for example, menu items, are also enabled / disabled) and call the method set_sensitive in gtk.Action instead (although this is another method from gtk.Widget one, the use is exactly the same, except that the button will not be enabled if the parent gtk.ActionGroup disabled).

+13
source share

All Articles