code: def on_menu_exit(self, event):
          
          # also delete appropriate copy file
          try:
              self.help_window.Destroy()
          except:
              pass
          if '-i' in sys.argv:
              self.Destroy()
          try:
              sys.exit() # can raise TypeError if wx inspector was used
          except Exception as ex:
              if isinstance(ex, TypeError):
                  pass
              else:
                  raise ex
docs: Exit the GUI