On 9/09/2003 6:52 AM, Michael McLay wrote:

On Monday 08 September 2003 06:55 pm, Christian Reis wrote:


On Fri, Sep 05, 2003 at 11:57:22AM +0800, James Henstridge wrote:


On 4/09/2003 8:00 AM, Michael McLay wrote:


I received an odd warning when testing the use of get_property.
Accessing the 'child' property for a button returns the message:

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



c.get_property('child')


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

Here's the code that caused this to happen.


the GtkContainer::child property is write-only, which is why you get
weird results when trying to read it. The other cases are most likely
similar.


Would it be possible to raise a proper exception in this case explaining
it is write-only?



I'm curious, what is the purpose of a write-only property? Under what circumstances would it be advantagous to not be able to do introspection on a property? Even if this does raise a special "Write-Only" exception, it still requires a special work around for code that is looking to probe the state of the object.


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.

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