Reputation: 995
how to can I check if a frame was exited by the user clicking the close button. I need to know because I have two wx.frames, a child and parent. When the parent frame is closed the how do I close the child frame? I'm using wxpython
Upvotes: 0
Views: 700
Reputation: 2053
Lets say the main Parent frame be parent.
class parent(wx.Frame):
def __init__(self, parent):
## Ur GUI's code ##
self.Bind( wx.EVT_CLOSE, self.ParentFrameOnClose )
def ParentFrameOnClose(self, event):
self.DestroyChildren() ## Destroy the children first
self.Destroy() ## Destroy the parent then.
Upvotes: 2