tags:

views:

60

answers:

1

Hi to all. I have a gtk.Notebook and i want get text of label from current gtk.noteBook tab. I make that:

text = self.get_tab_label(self.get_nth_page(self.get_current_page())) 

if i print text i see: But in gtk help i read that: get_tab_label_text: returnvalue: the text of the tab label, or None if the tab label widget is not a gtk.Label.

How can i get tet from label in this situation?

Thank you.

+1  A: 

Any gtk.Widget can be a Notebook tab label. It is usually a gtk.Label, but not always. So two API methods exist to cover both situations:

  1. gtk.Notebook.get_tab_label() returns a gtk.Widget that is the label widget. If it is a gtk.Label, you will need to call gtk.Label.get_text() to get the text.

  2. gtk.Notebook.get_tab_label_text() returns a string of text only if the label widget is a gtk.Label, otherwise will return None.

Ali A