wxPython App - Ensure All Dialogs are Destroyed

I'm working on an application that will need to use a variety of Dialogs. I'm having trouble getting events bound in a way that ensures that my Dialogs are destroyed properly if someone closes the application before dismissing the dialogs. I would expect to use something like this:

class Form(wx.Dialog):
 def __init__(self):
  wx.Dialog.__init__(None, -1, "Dialog")
  self.Bind(wx.EVT_CLOSE, self.onClose)
  self.Bind(wx.EVT_CLOSE, self.onClose, MAIN_WINDOW)
  ...
 def onClose(self, evt):
  self.Destroy()

The behavior I'm currently encountering is that if someone opens a Dialog, then closes the Application before dismissing the Dialog the Application does not exit fully. MAIN_WINDOW is a reference to the Frame that's registered as my Top Level Window. Thanks in advance!

Answers


I was attempting to use event bubbling incorrectly. The solution is to make sure the Dialogs are children of the Top Level Window so that the Application exiting forces the Dialogs to destroy as well.

class Form(wx.Dialog):
 def __init__(self):
  wx.Dialog.__init__(MAIN_WINDOW, -1, "Dialog")
  self.Bind(wx.EVT_CLOSE, self.onClose)
  ...
 def onClose(self, evt):
  self.Destroy()

Need Your Help

I want to suppress the warning

php session warnings suppress

I have already tried many things like putting session_start() at begining of page at top very first position on the page but still it shows me warning

How to return the sublists in lstb if they exist in lsta, while excluding certain words in the match?

python regex list match sublist

How do you return only the sublists in lstb if only part of the first item of each sublist in lstb is present within lsta? Is it possible to get a match if only 80% of the string matches an 80% of ...