[pygtk] 'name' attribute for objects created by gtk.Builder

Alessandro Dentella sandro at e-den.it
Sat Dec 11 20:59:30 WST 2010


Hi, 

in the process of migrating from glade to Builder I wrote the 2 attached test
files, where the main part is:

  >>> gld = gtk.glade.xml_new_from_buffer(__doc__,len(__doc__))
  >>> gld.get_widget('window1').connect('destroy', gtk.main_quit)
  >>> print "Lable.name", gld.get_widget('label1').name
  label1

  >>> bld = gtk.Builder()
  >>> bld.add_from_string(__doc__)
  >>> bld.get_object('window1').connect('destroy', gtk.main_quit)
  >>> print "Lable.name", bld.get_object('label1').name
  None

Where clearlu 'name' attribute is empty for the object created w/ Builder
and has the name I gave to the object in glade, for libglade.

I don't know it a 'name' object should exists, but which is the canonical
way to the get the name given in the glade interface?

Not that clearly get_object('label1') works correctly!


thanks in advance
sandro
*:-)



-- 
Sandro Dentella  *:-)
http://www.reteisi.org             Soluzioni libere per le scuole
http://sqlkit.argolinux.org        SQLkit home page - PyGTK/python/sqlalchemy
-------------- parte successiva --------------
Un allegato non testuale è stato rimosso....
Nome:        name-builder.py
Tipo:        text/x-python
Dimensione:  639 bytes
Descrizione: non disponibile
URL:         <http://www.daa.com.au/pipermail/pygtk/attachments/20101211/dc037019/attachment.py>
-------------- parte successiva --------------
Un allegato non testuale è stato rimosso....
Nome:        name-glade.py
Tipo:        text/x-python
Dimensione:  687 bytes
Descrizione: non disponibile
URL:         <http://www.daa.com.au/pipermail/pygtk/attachments/20101211/dc037019/attachment-0001.py>


More information about the pygtk mailing list