我有一个正在尝试开发的程序,但我想我不知道制作子帧的正确方法。我看过几个例子,似乎无法让它在关闭时破坏框架。我得到以下错误读数(使用 pycharm):
Exception wx._core.PyDeadObjectError: PyDeadObjectError('The C++ part of the
Choice object has been deleted, attribute access no longer allowed.',) in
<bound method pvFileINdialog.__del__ of <fileIO.pvFileIOGUIFileIOdialog.pvFileINdialog;
proxy of <Swig Object of type 'wxDialog *' at 0x340cc70> >> ignored
虽然口译员会处理这个问题,但我想学习处理它的正确方法。
如果我移动破坏和关闭命令,任何组合都不会改变结果。
感兴趣的代码是:
#in MainFrame.py:
def fileimport(self, event):
importprompt = pvFileIOGUIFileIOdialog.pvFileINdialog(self)
importprompt.ShowModal()
importprompt.Destroy()
#referring to pvFileIOGUIFileIOdialog.pvFileINdialog :
class pvFileINdialog(pvFileIOGUI.FileINdialog):
def __init__(self, child):
pvFileIOGUI.FileINdialog.__init__(self, child)
#which refers to pvFileIOGUI.FileINdialog :
class FileINdialog(wx.Dialog):
def __init__(self, child):
wx.Dialog.__init__(self, child, id=wx.ID_ANY, title=u"Select Import Method...", pos=wx.DefaultPosition,
size=wx.Size(800, 600), style=wx.DEFAULT_DIALOG_STYLE)
#and is closed by this routine in pvFileIOGUIFileIOdialog.py:
def cancelclk(self, event):
self.Close()
return 0