Reputation: 4926
I'm trying to find whether some widget in gtk is a ComboBox widget. The is word dont seem to work here
def set_entries_editable(self, bool, widget):
'''define whether to enable/disable widget'''
if widget is gtk.ComboBoxEntry:
widget.set_sensitive(bool)
else:
widget.set_editable(bool)
Thanks!
Upvotes: 2
Views: 469
Reputation: 368954
is
is used to check object identity.
>>> a = [1, 2]
>>> b = [1, 2]
>>> a is b
False
>>> a is a
True
Use isinstance
to check whether the object is instance of specific type:
>>> isinstance(a, list)
True
if isinstance(widget, gtk.ComboBoxEntry):
Upvotes: 4