Hi list and discuss forum.
I am making an XmlResourceHandler for wx.py.shell.Shell like this:
class ShellXmlHandler(wx.xrc.XmlResourceHandler):
def __init__(self):
wx.xrc.XmlResourceHandler.__init__(self)
self.AddWindowStyles()
return
def CanHandle(self, node):
return self.IsOfClass(node, "Shell")
def DoCreateResource(self):
assert self.GetInstance() is None
shell = wx.py.shell.Shell(self.GetParentAsWindow(),
self.GetID(),
self.GetPosition(),
self.GetSize(),
self.GetStyle()
)
self.SetupWindow(shell)
self.CreateChildren(shell)
return shell
and in my app’s OnInit I am registering the handler like that:
wx.xrc.XmlResource.Get().InitAllHandlers()
wx.xrc.XmlResource.Get().InsertHandler(gui.agtres.ShellXmlHandler())
Its CanHandle never appears to be called (among others I have added a sys.exit(-1)
inside it) and when the application starts it displays a message like
02:21:05: XRC error: 317: no handler found for XML node "object" (class "Shell")
02:21:05: XRC error: 317: unexpected item in sizer
What could be possibly wrong?
I am using wxPython 4.0.6 on python 2.7.16 win32. Thank you very much.