In a 15-years old wxpython project I have the following source to create a subclass of wx.Dialog using XRC:
class NewDialog(wx.Dialog):
def __init__(self, parent):
res = xrc.XmlResource(XRC_NEWDIALOG_FILE)
pre = wx.PreDialog()
res.LoadOnDialog(pre, parent, XRC_NEWDIALOG)
self.PostCreate(pre)
To migrate this into new wxpython phoenix synthax, I only found a working, but for me not so nice solution:
class NewDialog(object):
def __init__(self, parent):
super(NewTreeDialog, self).__init__()
res = xrc.XmlResource(XRC_NEWDIALOG_FILE)
self.dlg = res.LoadDialog(parent, XRC_NEWDIALOG)
My problem is the NewDialog is not a subclass of wx.Dialog, but ‘has-a’ wx.Dialog. Change of this means to make my calling code like myNewDialog.Show() work, I need to add Show() method in NewDialog class or change the call to myMewDialog.dlg.Show()
Because I have a lot of subclass widgets using XRC and a huge amount of code, this change means, my migration need to add a lot of changes.
Do you have a better idea to solve my problem? Thanks in advance.