wxPython: "Nesting" wx.NoteBooks?
Josiah Carlson
jcarlson at uci.edu
Sun Oct 3 02:50:10 EDT 2004
> 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?
Though it is ugly, yes, it can be done. Nearly anything can be done
with wxPython, you just need to structure it correctly.
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.SubNoteBooks = []
for subnotebook in xrange(3):
self.SubNoteBooks.append(wx.Notebook(self.Notebook, -1))
self.Notebook.AddPage(self.SubNoteBooks[-1],
'Tab %i'%subnotebook)
for i in xrange(3):
self.SubNoteBooks[-1].AddPage(wx.Panel(
self.SubNoteBooks[-1], -1),
'SubTab %i %i'%(subnotebook,i))
app = wx.PySimpleApp()
frame = MainWindow(None, -1, "MultiTabControl")
frame.Show(1)
app.MainLoop()
More information about the Python-list
mailing list