Roberto Cavada wrote:

I need to retrieve sensitive state of a widget.
FAQ states I can use the get_state() method, but unfortunately I could not find any trace about that method, in my pygtk installation.

>>> import gtk
>>> w = gtk.Window()
>>> w.get_state()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'gtk.Window' object has no attribute 'get_state'

Probably this is due to my configuration, pygtk is 1.99.14.

About get_state(), code generator produces only the following warning during the building phase. This does not seem connected to the problem, though:

> Could not write method GdkEvent.get_state: No ArgType for GdkModifierType*

Sorry to bother you all with that, but maybe you can figure out what happens here.
If you are only interested in enabled/disabled state, you should probably try reading the "sensitive" property:
enabled = widget.get_prop('sensitive')

If you want to change the sensitive state, you should use widget.set_sensitive(). The widget state variable is used for more than just sensitivity, and won't necessarily do what you want (for instance, set_sensitive() will take care of child widgets). Generally set_state() is only useful to people implementing new widgets (although there are a few exceptions).

James.

--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/



_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Reply via email to