473,416 Members | 1,675 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 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 2985
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Russ Perry Jr | last post by:
I'm using "ID" and "Value" in the generic sense here... Let's say one page I had a <html:select> with a collection like this: <html:options collection="items" property="key"...
0
by: Paul Lee | last post by:
Hi everyone, I'm trying to nest one XML document inside another, but the only method I can think of (not being familiar with Java and DOM!) would involve nested while loops. Basically, I have...
32
by: Toby Newman | last post by:
At the page: http://www.strath.ac.uk/IT/Docs/Ccourse/subsection3_8_3.html#SECTION0008300000000000000 or http://tinyurl.com/4ptzs the author warns: "The for loop is frequently used, usually...
20
by: DraguVaso | last post by:
Hi, As a former VB-programmer I'm used to the "on error goto"-errorhandling. I see that in actually all the VB.NET-samples I can fin people use the "Try - catch"-errorhandling. Which of the...
11
by: Michel | last post by:
Hi everyone. I am trying to get this page to work using <script src="url/test.php?webid=ADSasdfasdwerqy34"> //you get my point in test.php I do something like this: var test='hello world.';...
53
by: fdmfdmfdm | last post by:
This is an interview question and I gave out my answer here, could you please check for me? Q. What are the memory allocation for static variable in a function, an automatic variable and global...
5
by: Maria Sudderman | last post by:
I have a prblem with the "onClick" command. onClick="insert('<a href="URI">', '</a>')"> but this is not correct! why? Maria
7
by: Nik Coughlin | last post by:
Further to my earlier post in alt.html, I ended up preparing these pages: http://nrkn.com/skinning/ They list different ways to "skin" an HTML element (ie add rounded corners, drop shadows,...
36
by: mdh | last post by:
May I ask the group this somewhat non-focused question....having now seen "continue" used in some of the solutions I have worked on. ( Ex 7-4 solution by Tondo and Gimpel comes to mind) Is there a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.