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