def on_open_my_frame(self, event):
f = MyFrame(self)
f.Show()
I am a bit surprised to see that this code works in the sense that the frame is opened and is functional. Indeed, I would expect troubles as the frame is 1) modeless 2) created locally which should trigger garbage collection and object destruction at the end of the scope. No ?
If so, does it mean that I must create my frame at the class level such as:
def on_open_my_frame(self, event):
if (getattr(self,"f",None) is not None):
self.f.Destroy()
self.f = MyFrame(self)
self.f.Show()
I work on a wxPython application in which I bound the main frame to an wx.EVT_MENU. When the event is triggered the corresponding callback pops up a wx.Frame (I need it to be modeless).
Here is the code for the callback:
def on_open_my_frame(self, event):
f = MyFrame(self)
f.Show()
I am a bit surprised to see that this code works in the sense that the frame is opened and is functional. Indeed, I would expect troubles as the frame is 1) modeless 2) created locally which should trigger garbage collection and object destruction at the end of the scope. No ?
If so, does it mean that I must create my frame at the class level such as:
def on_open_my_frame(self, event):
if (getattr(self,"f",None) is not None):
self.f.Destroy()
self.f = MyFrame(self)
self.f.Show()
what do you think ?
-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.