Programming
[Python] Sub frame does not destroy

Question Description

I need help with a Programming question. All explanations and answers will be used to help me learn.

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

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

.i can help you in your assignments...i can provide you good quality work so that you can get A gradings in your course.I can do your work in a very short time .......answers will be upto mark and correctly written..thanks.....waiting for your reply ,,ans soon...


University of Virginia

Anonymous
Top quality work from this tutor! I’ll be back!

Anonymous
It’s my second time using SP and the work has been great back to back :) The one and only resource on the Interwebs for the work that needs to be done!

Anonymous
Thanks, good work

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4
Similar Questions
Related Tags