I've found the wiki page (http://wiki.wxpython.org/WizardFromXRC) that shows how to create a wizard with XRC. This works great, as long as all the pages are wx.wizard.wxWizardPageSimple instances. See the code after my sig. But once you make even one of them a wx.wizard. wxWizardPage, the code fails with the traceback:
Traceback (most recent call last):
File "notsosimplewiz.py", line 45, in <module>
wizard.RunWizard(page1)
File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/wizard.py", line 365, in RunWizard
return _wizard.Wizard_RunWizard(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "firstPage" failed at /BUILD/wxPython-src-2.8.4.0/src/generic/wizard.cpp(690) in RunWizard(): can't run empty wizard
If you take the code below and change any one (or more) of the page objects from class="wxWizardPageSimple" to class="wxWizardPage", you'll get the traceback above.
Can anyone point me to some docs for how to use non-simple wizard pages with XRC?
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
import wx, wx.xrc
import wx.wizard
definition = """\
<?xml version="1.0" encoding="UTF-8"?>
<resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc">
<object class="wxWizard" name="SimpleWiz">
<style>wxDEFAULT_DIALOG_STYLE|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX</style>
<exstyle>wxWIZARD_EX_HELPBUTTON</exstyle>
<title>SimpleWiz</title>
<bitmap>wizard.png</bitmap>
<object class="wxWizardPageSimple" name="pgFirst">
<style>wxTAB_TRAVERSAL</style>
<object class="wxStaticText" name="wxID_STATIC">
<label>First Page</label>
</object>
</object>
<object class="wxWizardPageSimple" name="pgSecond">
<style>wxTAB_TRAVERSAL</style>
<object class="wxStaticText" name="wxID_STATIC">
<label>second page</label>
</object>
</object>
<object class="wxWizardPageSimple" name="pgThird">
<style>wxTAB_TRAVERSAL</style>
<object class="wxStaticText" name="wxID_STATIC">
<label>last page</label>
</object>
</object>
</object>
</resource>"""
app = wx.App(0)
# Load the XRC resource
resource = wx.xrc.EmptyXmlResource()
resource.LoadFromString(definition)
wizard = resource.LoadObject(None, 'SimpleWiz', 'wxWizard')
page1 = wx.xrc.XRCCTRL(wizard, 'pgFirst')
wizard.RunWizard(page1)
wizard.Destroy()
app.MainLoop()