开发者

get label from notebook tab

开发者 https://www.devze.com 2022-12-20 13:09 出处:网络
I have a gtk.Notebook and i want get text of label from current gtk.noteBook tab. I make that: text = self.get开发者_JAVA技巧_tab_label(self.get_nth_page(self.get_current_page()))

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

text = self.get开发者_JAVA技巧_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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消