code: def _create_wx_app():
      
      wxapp = wx.GetApp()
      if wxapp is None:
          wxapp = wx.App(False)
          wxapp.SetExitOnFrameDelete(True)
          # retain a reference to the app object so it does not get garbage
          # collected and cause segmentation faults
          _create_wx_app.theWxApp = wxapp
docs: Creates a wx.App instance if it has not been created sofar.