diff --git a/wxPython/demo/Choicebook.py b/wxPython/demo/Choicebook.py new file mode 100644 index 0000000000..de304a996e --- /dev/null +++ b/wxPython/demo/Choicebook.py @@ -0,0 +1,80 @@ + +import wx + +#---------------------------------------------------------------------------- + +pageTexts = [ "Yet", + "Another", + "Way", + "To", + "Select", + "Pages" + ] + + +class TestCB(wx.Choicebook): + def __init__(self, parent, id, log): + wx.Choicebook.__init__(self, parent, id + ) + self.log = log + + # Now make a bunch of panels for the choice book + count = 1 + for txt in pageTexts: + win = wx.Panel(self) + if count == 1: + st = wx.StaticText(win, -1, + "wx.Choicebook is yet another way to switch between 'page' windows", + (10, 10)) + else: + st = wx.StaticText(win, -1, "Page: %d" % count, (10,10)) + count += 1 + + self.AddPage(win, txt) + + self.Bind(wx.EVT_CHOICEBOOK_PAGE_CHANGED, self.OnPageChanged) + self.Bind(wx.EVT_CHOICEBOOK_PAGE_CHANGING, self.OnPageChanging) + + + def OnPageChanged(self, event): + old = event.GetOldSelection() + new = event.GetSelection() + sel = self.GetSelection() + self.log.write('OnPageChanged, old:%d, new:%d, sel:%d\n' % (old, new, sel)) + event.Skip() + + def OnPageChanging(self, event): + old = event.GetOldSelection() + new = event.GetSelection() + sel = self.GetSelection() + self.log.write('OnPageChanging, old:%d, new:%d, sel:%d\n' % (old, new, sel)) + event.Skip() + +#---------------------------------------------------------------------------- + +def runTest(frame, nb, log): + testWin = TestCB(nb, -1, log) + return testWin + +#---------------------------------------------------------------------------- + + +overview = """\ +
+
+
+This class is a control similar to a notebook control, but uses a
+wx.Choice to manage the selection of the pages.
+
+"""
+
+
+
+if __name__ == '__main__':
+ import sys,os
+ import run
+ run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
+
+
+
diff --git a/wxPython/demo/Listbook.py b/wxPython/demo/Listbook.py
index cc3f2f77d9..cb620fe83d 100644
--- a/wxPython/demo/Listbook.py
+++ b/wxPython/demo/Listbook.py
@@ -1,6 +1,4 @@
-import sys
-
import wx
import ColorPanel
diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py
index 37b4fa8b83..eed065bf0f 100644
--- a/wxPython/demo/Main.py
+++ b/wxPython/demo/Main.py
@@ -49,6 +49,7 @@ _treeList = [
('Recent Additions/Updates', [
'StockButtons',
'Ticker',
+ 'Choicebook',
]),
# managed windows == things with a (optional) caption you can close
@@ -89,6 +90,7 @@ _treeList = [
'CheckBox',
'CheckListBox',
'Choice',
+ 'Choicebook',
'ComboBox',
'Gauge',
'Grid',
diff --git a/wxPython/src/_notebook.i b/wxPython/src/_notebook.i
index db05752cf2..f17b14e993 100644
--- a/wxPython/src/_notebook.i
+++ b/wxPython/src/_notebook.i
@@ -261,7 +261,7 @@ class NotebookPage(wx.Panel):
wx.Panel.__init__(self, parent, id, pos, size, style, name)
self.child = None
EVT_SIZE(self, self.OnSize)
-
+
def OnSize(self, evt):
if self.child is None:
children = self.GetChildren()
@@ -321,7 +321,7 @@ public:
// returns True if we have wxLB_TOP or wxLB_BOTTOM style
bool IsVertical() const;
- wxListView* GetListView();
+ wxListView* GetListView();
};
@@ -343,6 +343,72 @@ public:
}
+//---------------------------------------------------------------------------
+
+%{
+#include