I'm trying to delete a frame, which only holds a single button. Once the button is pressed, I want the whole frame to be deleted (but not the application, since this frame is a child of another frame).
The code [1] I have so far for this calls, on an Event from the button, the __del__ function, but doesn't delete the actual frame.
How do I delete this frame through a widget, rather than the window manager specific widgets?
Thanks in advance,
adam
[1]
class LetterFrame(wxFrame):
def __init__(self,parent,ID,title, whichbutton):
wxFrame.__init__(self,parent,wxID_ANY,title, pos=wxDefaultPosition, size=wxDefaultSize,style=wxDEFAULT_DIALOG_STYLE)
def addtext(self,text):
#showtext = str(text) # wxStaticText needs a string
alphabetgraphics = {30:'angelfish.bmp',31:'balloons.bmp',32:'crocodile.bmp',33:'dog.bmp',34:'eagle.bmp',35:'frog.bmp',36:'giraffe.bmp',37:'horse.bmp',38:'igloo.bmp',39:'jester.bmp',40:'kangaroo.bmp',41:'lizard.bmp',42:'moose.bmp',43:'nest.bmp',44:'octopus.bmp',45:'penguin.bmp',46:'queen.bmp',47:'rhinoceros.bmp',48:'seal.bmp',49:'tiger.bmp',50:'umbrella.bmp',51:'vulture.bmp',52:'wolf.bmp',53:'fox.bmp',54:'yacht.bmp',55:'zebra.bmp'}
bmp = wxBitmap('alphabet_media/' + alphabetgraphics[text], wxBITMAP_TYPE_BMP)
self.button = wxBitmapButton(self, text, bmp, wxPoint(160,20), wxSize(bmp.GetWidth()+10,bmp.GetHeight()+10))
self.thissizer = wxGridSizer(1,1,0,0)
self.thissizer.Add(self.button,1,wxEXPAND)
EVT_BUTTON(self.button,text, self.__del__())
def __del__(self):
print 'goodbye'
del self
···
--