]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxNotebook.py
Added accessor for the main window in generic wxListCtrl. In wxMSW
[wxWidgets.git] / wxPython / demo / wxNotebook.py
index 00d2f5b9d007b51fe83cf0142f2dd6af9b53a7f1..87aa2b14b9eee53be2b0ab21d20e2048226e1f3c 100644 (file)
@@ -6,6 +6,8 @@ import GridSimple
 import wxListCtrl
 import wxScrolledWindow
 
+import sys
+
 #----------------------------------------------------------------------------
 
 class TestNB(wxNotebook):
@@ -53,10 +55,19 @@ class TestNB(wxNotebook):
         self.AddPage(win, "INDIAN RED")
 
         EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
+        EVT_NOTEBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
 
 
     def OnPageChanged(self, event):
-        self.log.write('OnPageChanged\n')
+        old = event.GetOldSelection()
+        new = event.GetSelection()
+        self.log.write('OnPageChanged, old:%d, new:%d\n' % (old, new))
+        event.Skip()
+
+    def OnPageChanging(self, event):
+        old = event.GetOldSelection()
+        new = event.GetSelection()
+        self.log.write('OnPageChanging, old:%d, new:%d\n' % (old, new))
         event.Skip()
 
 
@@ -85,3 +96,14 @@ This class represents a notebook control, which manages multiple windows with as
 To use the class, create a wxNotebook object and call AddPage or InsertPage, passing a window to be used as the page. Do not explicitly delete the window for a page that is currently managed by wxNotebook.
 
 """
+
+
+if __name__ == "__main__":
+    app = wxPySimpleApp()
+    frame = wxFrame(None, -1, "Test Notebook", size=(600, 400))
+    win = TestNB(frame, -1, sys.stdout)
+    frame.Show(true)
+    app.MainLoop()
+
+
+