I have a program i’m trying to develop but i guess i don’t know the proper way to make subframes. I’ve looked at several examples and can’t seem to get it to work destroy the frame when it’s closed. I get the following error readout (using 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
All though the interpreter takes care of the problem i would like to learn the propper way to take care of it. Here is a zip of the entire program so far. When you run it and click “file/Import data” the subframe opens, and then when you hit the “cancel” button or the “x” button it closes but reports the error.
If moved the destroy and close commands around and nothing changes the result
The code of interest is:
#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


0 comments