2 from wxPython
.wx
import *
7 import wxScrolledWindow
9 #----------------------------------------------------------------------------
11 class TestNB(wxNotebook
):
12 def __init__(self
, parent
, id, log
):
13 wxNotebook
.__init
__(self
, parent
, id, style
=wxNB_BOTTOM
)
16 win
= ColorPanel
.ColoredPanel(self
, wxBLUE
)
17 self
.AddPage(win
, "Blue")
18 st
= wxStaticText(win
, -1,
19 "You can put nearly any type of window here,\n"
20 "and the tabs can be on any side... (look below.)",
22 st
.SetForegroundColour(wxWHITE
)
23 st
.SetBackgroundColour(wxBLUE
)
25 win
= ColorPanel
.ColoredPanel(self
, wxRED
)
26 self
.AddPage(win
, "Red")
28 win
= wxScrolledWindow
.MyCanvas(self
)
29 self
.AddPage(win
, 'ScrolledWindow')
31 win
= ColorPanel
.ColoredPanel(self
, wxGREEN
)
32 self
.AddPage(win
, "Green")
34 win
= GridSimple
.SimpleGrid(self
, log
)
35 self
.AddPage(win
, "Grid")
37 win
= wxListCtrl
.TestListCtrlPanel(self
, log
)
38 self
.AddPage(win
, 'List')
40 win
= ColorPanel
.ColoredPanel(self
, wxCYAN
)
41 self
.AddPage(win
, "Cyan")
43 win
= ColorPanel
.ColoredPanel(self
, wxWHITE
)
44 self
.AddPage(win
, "White")
46 win
= ColorPanel
.ColoredPanel(self
, wxBLACK
)
47 self
.AddPage(win
, "Black")
49 win
= ColorPanel
.ColoredPanel(self
, wxNamedColour('MIDNIGHT BLUE'))
50 self
.AddPage(win
, "MIDNIGHT BLUE")
52 win
= ColorPanel
.ColoredPanel(self
, wxNamedColour('INDIAN RED'))
53 self
.AddPage(win
, "INDIAN RED")
55 EVT_NOTEBOOK_PAGE_CHANGED(self
, self
.GetId(), self
.OnPageChanged
)
58 def OnPageChanged(self
, event
):
59 self
.log
.write('OnPageChanged\n')
63 #----------------------------------------------------------------------------
65 def runTest(frame
, nb
, log
):
66 testWin
= TestNB(nb
, -1, log
)
69 #----------------------------------------------------------------------------
83 This class represents a notebook control, which manages multiple windows with associated tabs.
85 To use the class, create a wxNotebook object and call AddPage or InsertPage, passing a window to be used as the page. Do not explicitly delete the window for a page that is currently managed by wxNotebook.