0
我有一個程序,我試圖發展,但我想我不知道正確的方式來製作子幀。我已經看過幾個例子,並且在關閉時似乎無法消除它。我收到以下錯誤讀數(使用pycharm):子框架不摧毀python
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
雖然解釋需要照顧的問題,我想學會照顧它的正確方法。
如果我移動destroy和close命令,則不會改變結果。
感興趣的代碼是:
#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
不認爲你需要銷燬...通常它會自動完成。請嘗試改變它'importprompt = None'。 –
謝謝,但這似乎並沒有解決它。 –
您的'pvFileINdialog'類或超類有'__del__'方法嗎?回溯表明它可能會這樣做。 –