18

How can I set a gtk.Button enabled or disabled in PyGTK?

Dan Getz
  • 8,774
  • 6
  • 30
  • 64
0xAX
  • 20,957
  • 26
  • 117
  • 206

2 Answers2

32
my_button.set_sensitive(False)

True is enabled, False disabled. See the gtk.Widget documentation.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
  • 7
    Note, sensitivity can also be turned off for any widget, so you can desensitize an entire box, form, window, etc. – ThorSummoner Sep 07 '15 at 02:10
1

If you don't want to see the object then you could button.set_visible(False) to hide it or button.set_visible(True) to show it. This will prevent users from seeing the button.