4 #----------------------------------------------------------------------------
15 class TestCB(wx
.Choicebook
):
16 def __init__(self
, parent
, id, log
):
17 wx
.Choicebook
.__init
__(self
, parent
, id
21 # Now make a bunch of panels for the choice book
26 st
= wx
.StaticText(win
, -1,
27 "wx.Choicebook is yet another way to switch between 'page' windows",
30 st
= wx
.StaticText(win
, -1, "Page: %d" % count
, (10,10))
33 self
.AddPage(win
, txt
)
35 self
.Bind(wx
.EVT_CHOICEBOOK_PAGE_CHANGED
, self
.OnPageChanged
)
36 self
.Bind(wx
.EVT_CHOICEBOOK_PAGE_CHANGING
, self
.OnPageChanging
)
39 def OnPageChanged(self
, event
):
40 old
= event
.GetOldSelection()
41 new
= event
.GetSelection()
42 sel
= self
.GetSelection()
43 self
.log
.write('OnPageChanged, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
46 def OnPageChanging(self
, event
):
47 old
= event
.GetOldSelection()
48 new
= event
.GetSelection()
49 sel
= self
.GetSelection()
50 self
.log
.write('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old
, new
, sel
))
53 #----------------------------------------------------------------------------
55 def runTest(frame
, nb
, log
):
56 testWin
= TestCB(nb
, -1, log
)
59 #----------------------------------------------------------------------------
64 <h2>wx.Choicebook</h2>
67 This class is a control similar to a notebook control, but uses a
68 wx.Choice to manage the selection of the pages.
74 if __name__
== '__main__':
77 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])