]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxListbook.py
1 # 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
5 # 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
7 # o Bunches of imports that might need to go away for the final roll-out.
18 colourList
= [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
19 "Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
20 "Dark Olive Green", "Dark Orchid", "Dark Slate Blue",
21 "Dark Slate Grey", "Dark Turquoise", "Dim Grey", "Firebrick",
22 "Forest Green", "Gold", "Goldenrod", "Grey", "Green", "Green Yellow",
23 "Indian Red", "Khaki", "Light Blue", "Light Grey", "Light Steel Blue",
24 "Lime Green", "Magenta", "Maroon", "Medium Aquamarine", "Medium Blue",
25 "Medium Forest Green", "Medium Goldenrod", "Medium Orchid",
26 "Medium Sea Green", "Medium Slate Blue", "Medium Spring Green",
27 "Medium Turquoise", "Medium Violet Red", "Midnight Blue", "Navy",
28 "Orange", "Orange Red", "Orchid", "Pale Green", "Pink", "Plum",
29 "Purple", "Red", "Salmon", "Sea Green", "Sienna", "Sky Blue",
30 "Slate Blue", "Spring Green", "Steel Blue", "Tan", "Thistle",
31 "Turquoise", "Violet", "Violet Red", "Wheat", "White", "Yellow",
35 #----------------------------------------------------------------------------
37 class TestLB(wx
.Listbook
):
38 def __init__(self
, parent
, id, log
):
39 wx
.Listbook
.__init
__(self
, parent
, id, style
=
49 # make an image list using the BlomXX images
50 il
= wx
.ImageList(32, 32)
51 for x
in range(1, 15):
52 f
= getattr(images
, 'getBlom%02dBitmap' % x
)
55 self
.AssignImageList(il
)
57 # Now make a bunch of panels for the list book
60 for colour
in colourList
:
61 win
= self
.makeColorPanel(colour
)
62 self
.AddPage(win
, colour
, imageId
=imID
)
64 if imID
== il
.GetImageCount(): imID
= 0
66 st
= wx
.StaticText(win
.win
, -1,
67 "You can put nearly any type of window here,\n"
68 "and the list can be on any side of the Listbook",
70 #st.SetForegroundColour(wxWHITE)
71 #st.SetBackgroundColour(wxBLUE)
76 wx
.EVT_LISTBOOK_PAGE_CHANGED(self
, self
.GetId(), self
.OnPageChanged
)
77 wx
.EVT_LISTBOOK_PAGE_CHANGING(self
, self
.GetId(), self
.OnPageChanging
)
80 def makeColorPanel(self
, color
):
81 p
= wx
.Panel(self
, -1)
82 win
= ColorPanel
.ColoredPanel(p
, color
)
84 def OnCPSize(evt
, win
=win
):
85 win
.SetSize(evt
.GetSize())
86 p
.Bind(wx
.EVT_SIZE
, OnCPSize
)
90 def OnPageChanged(self
, event
):
91 old
= event
.GetOldSelection()
92 new
= event
.GetSelection()
93 sel
= self
.GetSelection()
94 self
.log
.write('OnPageChanged, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
97 def OnPageChanging(self
, event
):
98 old
= event
.GetOldSelection()
99 new
= event
.GetSelection()
100 sel
= self
.GetSelection()
101 self
.log
.write('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
104 #----------------------------------------------------------------------------
106 def runTest(frame
, nb
, log
):
107 testWin
= TestLB(nb
, -1, log
)
110 #----------------------------------------------------------------------------
117 This class is a control similar to a notebook control, but with a
118 wxListCtrl instead of a set of tabs.
124 if __name__
== '__main__':
127 run
.main(['', os
.path
.basename(sys
.argv
[0])])