Change tab title in wx.Notebook

I am experimenting with wxPython,

I have a tabbed interface (notepad), and each tab is basically a list of files (yes, I'm trying to create a file manager)

The list of files inherits from wx.ListCtrl, and the tabbed interface inherits from wx.Notebook

I'm just starting .. and I had it so that a double click on a folder would be written to this folder, but I also want to change the name of the tab.

How to do it?

I have an object that represents a list of files and a header that I want to set,

[ EDIT Notebook.SetPageText() accepts a number, so I cannot pass the tab object directly to it]

my current approach is to cycle through the tabs until one of them matches my tab:

    for tab_id in range(self.GetPageCount()):
        if self.GetPage(tab_id) == tab:
            self.SetPageText(tab_id, title)
            break

, ?

+3
3

wxPython, , ++.

wxNotebook:: GetSelection(), wxNOT_FOUND , wxNotebook:: SetPageText().

wxNotebook:: GetPage() , , .

+2

, - :


notebook.get_tab_label(notebook.get_nth_page(your_page_number)).set_text("Your text")

, "switch-page" .

0

.GetPage wx.Window, , tab.Label = title .

-1

Source: https://habr.com/ru/post/1705924/


All Articles