7 colourList
= [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
8 "Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
9 "Dark Olive Green", "Dark Orchid", "Dark Slate Blue",
10 "Dark Slate Grey", "Dark Turquoise", "Dim Grey", "Firebrick",
11 "Forest Green", "Gold", "Goldenrod", "Grey", "Green", "Green Yellow",
12 "Indian Red", "Khaki", "Light Blue", "Light Grey", "Light Steel Blue",
13 "Lime Green", "Magenta", "Maroon", "Medium Aquamarine", "Medium Blue",
14 "Medium Forest Green", "Medium Goldenrod", "Medium Orchid",
15 "Medium Sea Green", "Medium Slate Blue", "Medium Spring Green",
16 "Medium Turquoise", "Medium Violet Red", "Midnight Blue", "Navy",
17 "Orange", "Orange Red", "Orchid", "Pale Green", "Pink", "Plum",
18 "Purple", "Red", "Salmon", "Sea Green", "Sienna", "Sky Blue",
19 "Slate Blue", "Spring Green", "Steel Blue", "Tan", "Thistle",
20 "Turquoise", "Violet", "Violet Red", "Wheat", "White", "Yellow",
24 #----------------------------------------------------------------------------
26 class TestLB(wx
.Listbook
):
27 def __init__(self
, parent
, id, log
):
28 wx
.Listbook
.__init
__(self
, parent
, id, style
=
37 # make an image list using the BlomXX images
38 il
= wx
.ImageList(32, 32)
39 for x
in range(1, 15):
40 f
= getattr(images
, 'getBlom%02dBitmap' % x
)
43 self
.AssignImageList(il
)
45 # Now make a bunch of panels for the list book
48 for colour
in colourList
:
49 win
= self
.makeColorPanel(colour
)
50 self
.AddPage(win
, colour
, imageId
=imID
)
52 if imID
== il
.GetImageCount(): imID
= 0
54 st
= wx
.StaticText(win
.win
, -1,
55 "You can put nearly any type of window here,\n"
56 "and the list can be on any side of the Listbook",
58 #st.SetForegroundColour(wxWHITE)
59 #st.SetBackgroundColour(wxBLUE)
62 self
.Bind(wx
.EVT_LISTBOOK_PAGE_CHANGED
, self
.OnPageChanged
)
63 self
.Bind(wx
.EVT_LISTBOOK_PAGE_CHANGING
, self
.OnPageChanging
)
66 def makeColorPanel(self
, color
):
67 p
= wx
.Panel(self
, -1)
68 win
= ColorPanel
.ColoredPanel(p
, color
)
70 def OnCPSize(evt
, win
=win
):
71 win
.SetSize(evt
.GetSize())
72 p
.Bind(wx
.EVT_SIZE
, OnCPSize
)
76 def OnPageChanged(self
, event
):
77 old
= event
.GetOldSelection()
78 new
= event
.GetSelection()
79 sel
= self
.GetSelection()
80 self
.log
.write('OnPageChanged, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
83 def OnPageChanging(self
, event
):
84 old
= event
.GetOldSelection()
85 new
= event
.GetSelection()
86 sel
= self
.GetSelection()
87 self
.log
.write('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
90 #----------------------------------------------------------------------------
92 def runTest(frame
, nb
, log
):
93 testWin
= TestLB(nb
, -1, log
)
96 #----------------------------------------------------------------------------
103 This class is a control similar to a notebook control, but with a
104 wx.ListCtrl instead of a set of tabs.
110 if __name__
== '__main__':
113 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])