FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 5.2 | Next Entry >>

5.2. How do I check if a widget is currently sensitive?

In pygtk, you get properties by calling the get_property() method:

  if widget.get_property('sensitive') == 0:
    print "I'm insensitive!"
Note: In ancient versions of pygtk (0.6.x) you could access them using a dictionary interface, this was removed in the 2.x series.

More recently (since PyGTK 2.8) the following method can be used:

  if not widget.props.sensitive:
    print "I'm insensitive!"
More info here: [live.gnome.org]

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org