Jonathan Viney wrote:

You need to use RunWizard for wizards, not Show or ShowModal. Also you need to explicitly import wx.wizard so the OOR system will know about the classes and so resource.LoadObject will return an object of wxWizard type instead of wxDialog.

Here is a working copy of your example:

   1 import wx, wx.xrc
   2 import wx.wizard
   3 
   4 print wx.VERSION
   5 
   6 
   7 definition = r'''<?xml version="1.0" ?>
   8 <resource>
   9     <object class="wxWizard" name="Wizard">
  10         <title>Test</title>
  11 
  12         <object class="wxWizardPageSimple" name="Page1">
  13             <object class="wxStaticText" name="label1">
  14                 <label>This is a static text label for Page 1.</label>
  15                 <pos>10,10</pos>
  16             </object>
  17         </object>
  18 
  19         <object class="wxWizardPageSimple" name="Page2">
  20             <object class="wxStaticText" name="label1">
  21                 <label>Page 2</label>
  22                 <pos>10,10</pos>
  23             </object>
  24         </object>
  25     </object>
  26 </resource>
  27 '''
  28 
  29 app = wx.App(0)
  30 
  31 # Load the XRC resource
  32 resource = wx.xrc.EmptyXmlResource()
  33 resource.LoadFromString(definition)
  34 
  35 wizard = resource.LoadObject(None, 'Wizard', 'wxWizard')
  36 page1 = wx.xrc.XRCCTRL(wizard, 'Page1')
  37 wizard.RunWizard(page1)
  38 wizard.Destroy()
  39 
  40 app.MainLoop()

WizardFromXRC (last edited 2008-03-11 10:50:37 by localhost)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.