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.

>>> b = gtk.Button()
>>> for x in gobject.list_properties(b):
...     print x.name, c.get_property(x.name)
...
user-data None
name sxx
parent None
width-request -1
height-request -1
visible False
sensitive True
app-paintable False
can-focus True
has-focus False
is-focus False
can-default False
has-default False
receives-default True
composite-child False
style <gtk.Style object (GtkStyle) at 0x40a8daf4>
events 0
extension-events 0
border-width 0
resize-mode 0

(:2640): Gtk-WARNING **: ../../gtk/gtkcontainer.c:874: invalid property id 3 
for "child" of type `GParamObject' in `GtkButton'
child None
label None
relief 0
use-underline False
use-stock False

I tried adding a child object, which changed the return value for c.child to 
the value of the label that was added to the button.
>>> c.add(l)
>>> c.child
<gtk.Label object (GtkLabel) at 0x40a8dbbc>

But this didn't fix the complaint about accessing 'child' using get_property

>>> c.get_property('child')

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


A warning also occurs when trying to access the 'pattern' property for a 
gtk.Label:

>>> for x in gobject.list_properties(l):
...     print x.name, l.get_property(x.name)
...
user-data None
name
parent None
width-request -1
height-request -1
visible False
sensitive True
app-paintable False
can-focus False
has-focus False
is-focus False
can-default False
has-default False
receives-default False
composite-child False
style <gtk.Style object (GtkStyle) at 0x40a8daf4>
events 0
extension-events 0
xalign 0.5
yalign 0.5
xpad 0
ypad 0
label
attributes None
use-markup False
use-underline False
justify 0

(:2640): Gtk-WARNING **: ../../gtk/gtklabel.c:569: invalid property id 6 for 
"pattern" of type `GParamString' in `GtkLabel'
pattern None
wrap False
selectable False
mnemonic-keyval 16777215
mnemonic-widget None
cursor-position 0
selection-bound 0
>>>

Setting l.pattern to a string value did not make the message go away
>>> l.pattern = "xxx"


>>> l.pattern
'xxx'
>>> l.set_property('pattern',"foo")
>>> l.pattern
'xxx'

_______________________________________________
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