471,073 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

wxPython: "Nesting" wx.NoteBooks?

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
Jul 18 '05 #1
3 2865
If you can find a serious User Interface Guide that recommends nesting
Notebook-type widgets, I'll try to help you answer this question.

It's nice that what you're asking for is apparently hard to provide,
because users will hate it, or else fail entirely to grasp what is going
on.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBXbs6Jd01MZaTXX0RAganAJ4oPbDuEQUv6W9ZnYuLyD ZYu2Qw6gCfcmtZ
utpzKknryY3bFUQItns1/kQ=
=Yi+J
-----END PGP SIGNATURE-----

Jul 18 '05 #2
> 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()
Jul 18 '05 #3
jc******@uci.edu (Josiah Carlson) wrote in message news:<88**************************@posting.google. com>...
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()


Thanks, Josiah. It took me some time to figure out how to put
something on a notebook panel (i.e. in which order the wx.Notebook and
the panel have to be created and which is the child of what), so
leaving out the panel for the "1st level notebooks" would habe
probably the last thing I would have tried.
Piet
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Paul Lee | last post: by
32 posts views Thread by Toby Newman | last post: by
20 posts views Thread by DraguVaso | last post: by
11 posts views Thread by Michel | last post: by
53 posts views Thread by fdmfdmfdm | last post: by
5 posts views Thread by Maria Sudderman | last post: by
7 posts views Thread by Nik Coughlin | last post: by
36 posts views Thread by mdh | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.