]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxNotebook.py
info about removal of wxhtml.rc
[wxWidgets.git] / wxPython / demo / wxNotebook.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
f0261a72 3
cf694132 4import ColorPanel
f6bcfd97 5import GridSimple
f0261a72
RD
6import wxListCtrl
7import wxScrolledWindow
cf694132 8
dfef5d51
RD
9import sys
10
cf694132
RD
11#----------------------------------------------------------------------------
12
eec92d76
RD
13class TestNB(wxNotebook):
14 def __init__(self, parent, id, log):
15 wxNotebook.__init__(self, parent, id, style=wxNB_BOTTOM)
16 self.log = log
cf694132 17
eec92d76
RD
18 win = ColorPanel.ColoredPanel(self, wxBLUE)
19 self.AddPage(win, "Blue")
20 st = wxStaticText(win, -1,
21 "You can put nearly any type of window here,\n"
22 "and the tabs can be on any side... (look below.)",
23 wxPoint(10, 10))
24 st.SetForegroundColour(wxWHITE)
25 st.SetBackgroundColour(wxBLUE)
cf694132 26
eec92d76
RD
27 win = ColorPanel.ColoredPanel(self, wxRED)
28 self.AddPage(win, "Red")
cf694132 29
eec92d76
RD
30 win = wxScrolledWindow.MyCanvas(self)
31 self.AddPage(win, 'ScrolledWindow')
cf694132 32
eec92d76
RD
33 win = ColorPanel.ColoredPanel(self, wxGREEN)
34 self.AddPage(win, "Green")
f0261a72 35
f6bcfd97 36 win = GridSimple.SimpleGrid(self, log)
eec92d76 37 self.AddPage(win, "Grid")
cf694132 38
eec92d76
RD
39 win = wxListCtrl.TestListCtrlPanel(self, log)
40 self.AddPage(win, 'List')
f0261a72 41
eec92d76
RD
42 win = ColorPanel.ColoredPanel(self, wxCYAN)
43 self.AddPage(win, "Cyan")
f0261a72 44
eec92d76
RD
45 win = ColorPanel.ColoredPanel(self, wxWHITE)
46 self.AddPage(win, "White")
cf694132 47
eec92d76
RD
48 win = ColorPanel.ColoredPanel(self, wxBLACK)
49 self.AddPage(win, "Black")
cf694132 50
eec92d76
RD
51 win = ColorPanel.ColoredPanel(self, wxNamedColour('MIDNIGHT BLUE'))
52 self.AddPage(win, "MIDNIGHT BLUE")
cf694132 53
eec92d76
RD
54 win = ColorPanel.ColoredPanel(self, wxNamedColour('INDIAN RED'))
55 self.AddPage(win, "INDIAN RED")
cf694132 56
eec92d76 57 EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
cf694132 58
cf694132 59
eec92d76
RD
60 def OnPageChanged(self, event):
61 self.log.write('OnPageChanged\n')
62 event.Skip()
cf694132
RD
63
64
eec92d76 65#----------------------------------------------------------------------------
cf694132 66
eec92d76
RD
67def runTest(frame, nb, log):
68 testWin = TestNB(nb, -1, log)
69 return testWin
70
71#----------------------------------------------------------------------------
cf694132
RD
72
73
74
75
76
77
78
79
80
81
82
83
84overview = """\
85This class represents a notebook control, which manages multiple windows with associated tabs.
86
87To 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.
88
cf694132 89"""
dfef5d51
RD
90
91
92if __name__ == "__main__":
93 app = wxPySimpleApp()
94 frame = wxFrame(None, -1, "Test Notebook", size=(600, 400))
95 win = TestNB(frame, -1, sys.stdout)
96 frame.Show(true)
97 app.MainLoop()
98
99
100