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

RCS/faq05.013.htp,v  -->  standard output
revision 1.1
Title: 5.13. While calling get_property(), I get an "invalid property id" warning. Why?
Last-Changed-Date: Fri Sep 19 19:49:33 2003
Last-Changed-Author: Christian Reis
Last-Changed-Email: kiko@async.com.br
Last-Changed-Remote-Host: manonegra.async.com.br
Last-Changed-Remote-Address: 192.168.99.6

When using get_property(), you need to make sure the property you are using is not set as write-only. An example of such a property is GtkContainer::child, which isn't readable. The warning when trying to read it is something like:

  (:2640): Gtk-WARNING **: ../../gtk/gtkcontainer.c:874: invalid property
           id 3 for "child" of type `GParamObject' in `GtkButton'

Pretty much all instances of write-only properties in GTK are ones that set some other property, but take a different format. For instance, setting the "markup" property on a gtk.CellRendererText object is equivalent to setting the "text" and "attributes" properties to appropriate values, however "markup" is not readable.

The GtkContainer "child" property looks more like a convenience. Setting the property adds the widget to the container. However, GtkContainer can have multiple children, so it isn't clear what should be returned when reading it.

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