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

<< Previous Entry | FAQ Entry 7.2 | Next Entry >>

7.2. Where is GtkLabel.get_text()?

I don't know why the API is inconsistent, but the GtkLabel provides the method get() instead of get_text().

 l = gtk.Label("foobar")
 print l.get() # prints "foobar"
In PyGTK-2 you can use get_text() method:

 >>> l = gtk.Label("foobar")
 >>> print l.get_text()
 foobar
 >>> 
and also get() method still works:

 >>> print l.get()
 foobar

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