X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/299647acac7960652aadb008775429c1f8ea9b8d..c70aaa0984cec921b508b62dfb40a59b8d857e68:/wxPython/demo/Wizard.py?ds=sidebyside diff --git a/wxPython/demo/Wizard.py b/wxPython/demo/Wizard.py index 7c7d5d80f6..233f172d86 100644 --- a/wxPython/demo/Wizard.py +++ b/wxPython/demo/Wizard.py @@ -1,14 +1,6 @@ -# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o Updated for wx namespace -# -# 11/3-/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o WizardPage* doesn't support GetId() -# import wx -import wx.wizard as wiz +import wx.wizard as wiz import images #---------------------------------------------------------------------- @@ -18,8 +10,8 @@ def makePageTitle(wizPg, title): wizPg.SetSizer(sizer) title = wx.StaticText(wizPg, -1, title) title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) - sizer.AddWindow(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) - sizer.AddWindow(wx.StaticLine(wizPg, -1), 0, wx.EXPAND|wx.ALL, 5) + sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) + sizer.Add(wx.StaticLine(wizPg, -1), 0, wx.EXPAND|wx.ALL, 5) return sizer #---------------------------------------------------------------------- @@ -99,8 +91,6 @@ class UseAltBitmapPage(wiz.PyWizardPage): #---------------------------------------------------------------------- class TestPanel(wx.Panel): - ID_wiz = wx.NewId() - def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) @@ -111,9 +101,9 @@ class TestPanel(wx.Panel): b = wx.Button(self, -1, "Run Dynamic Wizard", pos=(50, 100)) self.Bind(wx.EVT_BUTTON, self.OnRunDynamicWizard, b) - wiz.EVT_WIZARD_PAGE_CHANGED(self, self.ID_wiz, self.OnWizPageChanged) - wiz.EVT_WIZARD_PAGE_CHANGING(self, self.ID_wiz, self.OnWizPageChanging) - wiz.EVT_WIZARD_CANCEL(self, self.ID_wiz, self.OnWizCancel) + self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged) + self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) + self.Bind(wiz.EVT_WIZARD_CANCEL, self.OnWizCancel) def OnWizPageChanged(self, evt): @@ -146,14 +136,14 @@ class TestPanel(wx.Panel): wx.MessageBox("Cancelling on the first page has been prevented.", "Sorry") evt.Veto() + def OnWizFinished(self, evt): self.log.write("OnWizFinished\n") def OnRunSimpleWizard(self, evt): # Create the wizard and the pages - wizard = wiz.Wizard(self, self.ID_wiz, "Simple Wizard", - images.getWizTest1Bitmap()) + wizard = wiz.Wizard(self, -1, "Simple Wizard", images.getWizTest1Bitmap()) page1 = TitledPage(wizard, "Page 1") page2 = TitledPage(wizard, "Page 2") page3 = TitledPage(wizard, "Page 3") @@ -173,6 +163,7 @@ wxWizardPageSimple class can easily be used for the pages.""")) wiz.WizardPageSimple_Chain(page2, page3) wiz.WizardPageSimple_Chain(page3, page4) + wizard.GetPageAreaSizer().Add(page1) if wizard.RunWizard(page1): wx.MessageBox("Wizard completed successfully", "That's all folks!") else: @@ -186,8 +177,7 @@ wxWizardPageSimple class can easily be used for the pages.""")) #wizard.SetExtraStyle(wx.WIZARD_EX_HELPBUTTON) #wizard.Create(self, self.ID_wiz, "Simple Wizard", # images.getWizTest1Bitmap()) - wizard = wiz.Wizard(self, self.ID_wiz, "Simple Wizard", - images.getWizTest1Bitmap()) + wizard = wiz.Wizard(self, -1, "Dynamic Wizard", images.getWizTest1Bitmap()) page1 = TitledPage(wizard, "Page 1") page2 = SkipNextPage(wizard, "Page 2") @@ -214,6 +204,7 @@ of the pages and also which bitmap is shown. page5.SetPrev(page4) + wizard.GetPageAreaSizer().Add(page1) if wizard.RunWizard(page1): wx.MessageBox("Wizard completed successfully", "That's all folks!") else: @@ -249,5 +240,5 @@ it is important to keep them as simple as possible. if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])