code: def on_btn_demag_gui(self, event):
          
          if not self.check_for_meas_file():
              return
          if not self.check_for_uncombined_files():
              return
  
          outstring = "demag_gui.py -WD %s"%self.WD
          print("-I- running python script:\n %s"%(outstring))
          if self.data_model_num == 2:
              demag_gui.start(self.WD, standalone_app=False, parent=self, DM=self.data_model_num)
          else:
              # disable and hide Pmag GUI mainframe
              self.Disable()
              self.Hide()
              # show busyinfo
              wait = wx.BusyInfo('Compiling required data, please wait...')
              wx.SafeYield()
              # create custom Demag GUI closing event and bind it
              DemagGuiExitEvent, EVT_DEMAG_GUI_EXIT = newevent.NewCommandEvent()
              self.Bind(EVT_DEMAG_GUI_EXIT, self.on_analysis_gui_exit)
              # make and show the Demag GUI frame
              demag_gui_frame = demag_gui.Demag_GUI(self.WD, self,
                                                    write_to_log_file=False,
                                                    data_model=self.data_model_num,
                                                    evt_quit=DemagGuiExitEvent)
              demag_gui_frame.Centre()
              demag_gui_frame.Show()
              del wait
docs: Open Demag GUI