> In a signal callback for a radio button, if I ask for its name
> (rb.get_name()) I always get "GtkRadioButton".  If I call get_property
> with "name" as the argument, I get the empty string.  Looking at the
> docs for gtk.Builder, I saw this:
>
> "Objects must be given a name with the "id" attribute, which allows
> the application to retrieve them from the builder with get_object().
> An id is also necessary to use the object as property value in other
> parts of the UI definition.
>
> Note: Prior to GTK+ 2.20, gtk.Builder was setting the "name" property
> of constructed widgets to the "id" attribute. In GTK+ 2.20 or newer,
> you have to use gtk.Buildable.get_name() instead of
> gtk.Widget.get_name() to obtain the "id", or set the "name" property
> in your UI definition."

I am going to answer my own question and report a documentation bug.
The gtk.Buildable.get_name() function takes a widget as an argument,
but the documentation omits that fact. See:

http://www.pygtk.org/docs/pygtk/class-gtkbuildable.html#method-gtkbuildable--set-name

More generally, shouldn't the widget's name property be populated by
the builder?  This change seems like it would cause a lot of needless
breakage to existing code ported from libglade to the builder stuff.

Skip
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to