7 colourList
= [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
8 "Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
12 #----------------------------------------------------------------------------
14 class TestLB(wx
.Listbook
):
15 def __init__(self
, parent
, id, log
):
16 wx
.Listbook
.__init
__(self
, parent
, id, style
=
25 # make an image list using the LBXX images
26 il
= wx
.ImageList(32, 32)
28 f
= getattr(images
, 'getLB%02dBitmap' % (x
+1))
31 self
.AssignImageList(il
)
33 # Now make a bunch of panels for the list book
36 for colour
in colourList
:
37 win
= self
.makeColorPanel(colour
)
38 self
.AddPage(win
, colour
, imageId
=imID
)
40 if imID
== il
.GetImageCount(): imID
= 0
42 st
= wx
.StaticText(win
.win
, -1,
43 "You can put nearly any type of window here,\n"
44 "and the list can be on any side of the Listbook",
48 self
.Bind(wx
.EVT_LISTBOOK_PAGE_CHANGED
, self
.OnPageChanged
)
49 self
.Bind(wx
.EVT_LISTBOOK_PAGE_CHANGING
, self
.OnPageChanging
)
52 def makeColorPanel(self
, color
):
53 p
= wx
.Panel(self
, -1)
54 win
= ColorPanel
.ColoredPanel(p
, color
)
56 def OnCPSize(evt
, win
=win
):
57 win
.SetPosition((0,0))
58 win
.SetSize(evt
.GetSize())
59 p
.Bind(wx
.EVT_SIZE
, OnCPSize
)
63 def OnPageChanged(self
, event
):
64 old
= event
.GetOldSelection()
65 new
= event
.GetSelection()
66 sel
= self
.GetSelection()
67 self
.log
.write('OnPageChanged, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
70 def OnPageChanging(self
, event
):
71 old
= event
.GetOldSelection()
72 new
= event
.GetSelection()
73 sel
= self
.GetSelection()
74 self
.log
.write('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
77 #----------------------------------------------------------------------------
79 def runTest(frame
, nb
, log
):
80 testWin
= TestLB(nb
, -1, log
)
83 #----------------------------------------------------------------------------
90 This class is a control similar to a notebook control, but with a
91 wx.ListCtrl instead of a set of tabs.
97 if __name__
== '__main__':
100 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])