wxPython: "Nesting" wx.NoteBooks?

Piet pit.grinja at gmx.de
Fri Oct 1 21:55:26 CEST 2004


Hi,
I am trying to generate an "hierarchical" layout based on
wx.NoteBooks. That means, every page of a Notebook should be a
NoteBookon its own. Here is a (short but complicated) piece of code
that I put together to see whether it works:

import wx
#____________________________

class MainWindow(wx.Frame):
    def __init__(self,parent,id,title):
        self.dirname=''
        wx.Frame.__init__(self,parent,-4, title,
style=wx.DEFAULT_FRAME_STYLE)
        self.Notebook =
wx.Notebook(self,-1,wx.DefaultPosition,wx.DefaultSize,wx.NB_TOP)
        self.panels = []
        self.SubNoteBooks = []

        for panelNumber in range(3):
            self.panels.append(wx.Panel(self.Notebook,-1))
            self.Notebook.AddPage(self.panels[panelNumber],"Tab"+str(panelNumber))#
            self.SubNoteBooks.append(wx.Notebook(self.panels[panelNumber],-1,wx.DefaultPosition,wx.DefaultSize,wx.NB_TOP))
            self.SubNoteBooks[panelNumber].subPanels = []
            for subPanelNumber in range(3):
                self.SubNoteBooks[panelNumber].subPanels.append(wx.Panel(self.SubNoteBooks[panelNumber],-1))
                self.SubNoteBooks[panelNumber].AddPage(self.SubNoteBooks[panelNumber].subPanels[subPanelNumber],"Subtab"+str(panelNumber)+str(subPanelNumber))

app = wx.PySimpleApp()
frame = MainWindow(None, -1, "MultiTabControl")
frame.Show(1)
app.MainLoop()

However, what I get is only the "first level", i.e. a normal NoteBook
with three tabs. Is it possible to get the "second level tabs"
working?
Many thanks in advance
Piet



More information about the Python-list mailing list