I cant find any examples online on how to use this method. I think that It may be something that I will use. Can someone provide me an example on how to use this method?
Based on the source code, I believe this is how you would do it.
def AddSubclassFactory(*args, **kwargs):
"""AddSubclassFactory(XmlSubclassFactory factory)"""
return _xrc.XmlResource_AddSubclassFactory(*args, **kwargs)
So you can see that it is looking for an object of type XmlSubclassFactory. From the documentation (http://wxpython.org/docs/api/wx.xrc.XmlSubclassFactory-class.html) we find...
XmlSubclassFactory __init__(self)
We can see that the constructor for XmlSubClassFactory takes no arguments. So we create an object of XmlSubclassFactory and create a resource to add the SubClassFactory to.
import wx
from wx import xrc
scf = xrc.XmlSubClassFactory()
resource = xrc.XmlResource("resource.xrc")
resource.AddSubclassFactory(scf)
I, unfortunately, could not find a Python example. However, I think the Perl analog is pretty close. From http://permalink.gmane.org/gmane.comp.lang.perl.wxperl/477
Wx::XmlResource::AddSubclassFactory( MyFactory->new ); // perl
This is pretty similar to what we are doing. So between reading the source code and that example, I believe the snippet is a good place to start. Good luck!
© 2022 - 2024 — McMap. All rights reserved.