def __init__(self, file_name): Wizard.__init__(self, None, -1, "Install app") self.Bind(wx.adv.EVT_WIZARD_PAGE_CHANGING, self.on_wiz_page_changing) self.ptig = Ptig(file_name) page1 = TitledPage(self, 1, _("Program description")) self.page1 = page1 page2 = TitledPage(self, 2, _("License")) page3 = TitledPage(self, 3, _("Run")) r_txt = wx.TextCtrl(page1, -1, size=wx.Size(600, 300), style=wx.TE_MULTILINE | wx.TE_READONLY) r_txt.SetValue(self.ptig.get_readme()) page1.sizer.Add(r_txt) self.FitToPage(page1) l_txt = wx.TextCtrl( page2, -1, self.ptig.get_license(), size=wx.Size(600, 300), style=wx.TE_MULTILINE | wx.TE_READONLY, ) page2.sizer.Add(l_txt) page2.sizer.AddSpacer(5) self.licence = wx.CheckBox(page2, -1, _("Accept")) page2.sizer.Add(self.licence) page3.sizer.Add( wx.StaticText(page3, -1, _("Run the installed program or cancel"))) WizardPageSimple.Chain(page1, page2) WizardPageSimple.Chain(page2, page3) self.GetPageAreaSizer().Add(page1)
def __init__(self, parent, title='Select new connection type'): WizardPageSimple.__init__(self, parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) titleText = wx.StaticText(self, -1, title) fs = self.GetFont().GetPointSize() bf = wx.Font(fs + 4, wx.SWISS, wx.NORMAL, wx.BOLD) nf = wx.Font(fs + 2, wx.SWISS, wx.NORMAL, wx.NORMAL) titleText.SetFont(bf) #################################################################### ''' Header section ''' self.tree = DatabaseNavigationTree(self) self.filter = wx.SearchCtrl(self, style=wx.TE_PROCESS_ENTER) self.filter.SetDescriptiveText("Type filter database name") self.filter.ShowCancelButton(True) self.filter.Bind(wx.EVT_TEXT, self.RecreateTree) self.filter.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, lambda e: self.filter.SetValue('')) self.filter.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) self.RecreateTree() #################################################################### self.sizer.Add(titleText, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 5) self.sizer.Add(self.filter, 0, wx.EXPAND | wx.ALL) self.sizer.Add(self.tree, 1, wx.EXPAND | wx.ALL)
def OnRunSimpleWizard(self, evt): # Create the wizard and the pages wizard = wiz(self, -1, "Simple Wizard", images.WizTest1.GetBitmap()) page1 = TitledPage(wizard, "Page 1") page2 = TitledPage(wizard, "Page 2") page3 = TitledPage(wizard, "Page 3") page4 = TitledPage(wizard, "Page 4") self.page1 = page1 page1.sizer.Add( wx.StaticText( page1, -1, """ This wizard is totally useless, but is meant to show how to chain simple wizard pages together in a non-dynamic manner. IOW, the order of the pages never changes, and so the wxWizardPageSimple class can easily be used for the pages.""")) wizard.FitToPage(page1) page4.sizer.Add(wx.StaticText(page4, -1, "\nThis is the last page.")) # Use the convenience Chain function to connect the pages WizardPageSimple.Chain(page1, page2) WizardPageSimple.Chain(page2, page3) WizardPageSimple.Chain(page3, page4) wizard.GetPageAreaSizer().Add(page1) if wizard.RunWizard(page1): wx.MessageBox("Wizard completed successfully", "That's all folks!") else: wx.MessageBox("Wizard was cancelled", "That's all folks!")
def __init__(self, parent, title): WizardPageSimple.__init__(self, parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) titleText = wx.StaticText(self, -1, title) titleText.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) self.sizer.Add(titleText, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 5)
def __init__(self, parent, title='define title'): WizardPageSimple.__init__(self, parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) titleText = wx.StaticText(self, -1, title) fs = self.GetFont().GetPointSize() bf = wx.Font(fs + 4, wx.SWISS, wx.NORMAL, wx.BOLD) nf = wx.Font(fs + 2, wx.SWISS, wx.NORMAL, wx.NORMAL) titleText.SetFont(bf) self.sizer.Add(titleText, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 5) #################################################################### self.panel = wx.Panel(self, -1) vbox1 = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox3 = wx.BoxSizer(wx.HORIZONTAL) connectionNameLabel = wx.StaticText(self.panel, -1, "Connection name : ") self.connectionNameTextCtrl = wx.TextCtrl(self.panel, size=(300, -1)) dbFileNameLabel = wx.StaticText(self.panel, -1, "Database File name : ") self.dbFileNameTextCtrl = wx.TextCtrl(self.panel, size=(300, -1)) self.connectionNameTextCtrl.Bind(wx.EVT_TEXT, self.onConnectionName) hbox1.Add(connectionNameLabel) hbox1.Add(self.connectionNameTextCtrl, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 1) hbox3.Add(dbFileNameLabel) hbox3.Add(self.dbFileNameTextCtrl, 0, wx.EXPAND | wx.ALIGN_LEFT | wx.ALL, 1) import wx.lib.filebrowsebutton as filebrowse self.dbb = filebrowse.DirBrowseButton(self.panel, -1, size=(450, -1), changeCallback=self.dbbCallback, startDirectory=wx.GetHomeDir()) self.dbb.SetValue(wx.GetHomeDir(), self.dbbCallback) # self.markFile = brows.FileBrowseButton(self.panel, labelText="File path :", fileMode=wx.FD_OPEN, size=(400, 30), toolTip='Type database filename or click browse to choose file') # self.markFile.Bind(wx.EVT_TEXT, self.onMarkFile) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox2.Add(self.dbb) vbox1.Add(hbox1) vbox1.Add(hbox2) vbox1.Add(hbox3) self.panel.SetSizer(vbox1) self.sizer.Add(self.panel, 0, wx.ALL, 5)
def main(): """""" wizard = Wizard(None, -1, "Simple Wizard") page1 = TitledPage(wizard, "Page 1") page2 = TitledPage(wizard, "Page 2") page3 = TitledPage(wizard, "Page 3") page4 = TitledPage(wizard, "Page 4") WizardPageSimple.Chain(page1, page2) WizardPageSimple.Chain(page2, page3) WizardPageSimple.Chain(page3, page4) wizard.FitToPage(page1) wizard.RunWizard(page1) wizard.Destroy()
def __init__(self, *args, **kwargs): super(ChaoShengHuo, self).__init__(*args, **kwargs) ChaoShengHuo.__instance = self # Create the wizard and the pages wizard = wiz(self, -1, "Simple Wizard", ) page1 = TitledPage(wizard, "Page 1") page2 = TitledPage(wizard, "Page 2") page3 = TitledPage(wizard, "Page 3") page4 = TitledPage(wizard, "Page 4") self.page1 = page1 page1.sizer.Add(wx.StaticText(page1, -1, """ This wizard is totally useless, but is meant to show how to chain simple wizard pages together in a non-dynamic manner. IOW, the order of the pages never changes, and so the wxWizardPageSimple class can easily be used for the pages.""")) wizard.FitToPage(page1) page4.sizer.Add(wx.StaticText(page4, -1, "\nThis is the last page.")) # Use the convenience Chain function to connect the pages WizardPageSimple.Chain(page1, page2) WizardPageSimple.Chain(page2, page3) WizardPageSimple.Chain(page3, page4) wizard.GetPageAreaSizer().Add(page1) if wizard.RunWizard(page1): print('end') else: print('cancel') self.Bind(wx.adv.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged) self.Bind(wx.adv.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) self.Bind(wx.adv.EVT_WIZARD_CANCEL, self.OnWizCancel) self.box = wx.BoxSizer(wx.VERTICAL) self.Layout()
def __init__(self, parent, lp, title): WizardPageSimple.__init__(self, parent) self.sizer = make_page_title(self, title) self.lp = lp
def __init__(self, parent, title): WizardPageSimple.__init__(self, parent) self.sizer = makePageTitle(self, title)
def __init__(self,parent,lp,title): WizardPageSimple.__init__(self, parent) self.sizer = make_page_title(self, title) self.lp = lp
#!/usr/bin/env python #-Imports---------------------------------------------------------------------- #--wxPython Imports. import wx if 'phoenix' in wx.version(): from wx.adv import Wizard, WizardPageSimple else: # Classic from wx.wizard import Wizard, WizardPageSimple if __name__ == '__main__': app = wx.App(False) mywiz = Wizard(None, -1, 'My Wizard') mywiz.pages = [] for i in range(3): page = WizardPageSimple(mywiz) st = wx.StaticText(page, -1, 'Wizard Page %d' % (i + 1)) if mywiz.pages: previous_page = mywiz.pages[-1] page.SetPrev(previous_page) previous_page.SetNext(page) mywiz.pages.append(page) mywiz.RunWizard(mywiz.pages[0]) mywiz.Destroy() app.MainLoop()