Hi,
I am having trouble getting a wxWizard using non-simple wxWizardPages
working from XRC. The way the application does XRC is a bit different
than usual; base classes which take care of the XRC stuff are
generated in advance and are subclassed elsewhere (this isn't my
design, but I will do my best to explain any other details needed).
The relevant part of the generated base class for the page looks like this:
class RulesetPageBase(wx.wizard.PyWizardPage):
xrc = os.path.join(location(), "windows", "xrc", 'SinglePlayerWizard.xrc')
def __init__(self, parent, *args, **kw):
f = os.path.join(os.path.dirname(__file__), self.xrc)
res = XmlResourceWithHandlers(f)
pre = wx.wizard.PrePyWizardPage()
res.LoadOnPanel(pre, parent, "RulesetPage")
self.PostCreate(pre)
...
The window that runs the wizard does the following (where
SinglePlayerWizard is the wizard class derived from
SinglePlayerWizardBase, and RulesetPage is a class derived from
RulesetPageBase):
...
wizard = SinglePlayerWizard(self)
wizard.RulesetPage = RulesetPage(wizard)
wizard.GetPageAreaSizer().Add(wizard.RulesetPage)
if wizard.RunWizard(wizard.RulesetPage):
...
Using version 2.8.7.1, calling RunWizard() caused a segmentation fault
in DoSetSize(). After upgrading to 2.8.8.1, I get the following:
Traceback (most recent call last):
File "./windows/winConnect.py", line 304, in OnSinglePlayer
wizard.GetPageAreaSizer().Add(wizard.RulesetPage)
File "usr/lib64/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 12596, in Add
wx._core.PyAssertionError: C++ assertion "(m_widget != __null)" failed
at /var/tmp/portage/x11-libs/wxGTK-2.8.8.1/work/wxPython-src-2.8.8.1/src/gtk/window.cpp(2894)
in DoGetSize(): invalid window
Research suggests that the page isn't being created properly. I didn't
show the wizard base class window creation code because it works fine
with wxWizardPageSimples. Can anyone tell me what I'm doing wrong?
Thanks!