code: def menu_callback(m):
      '''called on menu selection'''
      if m.returnkey.startswith('# '):
          cmd = m.returnkey[2:]
          if m.handler is not None:
              if m.handler_result is None:
                  return
              cmd += m.handler_result
          process_stdin(cmd)
      elif m.returnkey == 'menuSettings':
          wxsettings.WXSettings(mestate.settings)
      elif m.returnkey.startswith("mode-"):
          idx = int(m.returnkey[5:])
          mestate.flightmode_selections[idx] = m.IsChecked()
      elif m.returnkey.startswith("loadLog"):
          print("File: " + m.returnkey[8:])
      elif m.returnkey == 'quit':
          mestate.console.close()
          mestate.exit = True
          print("Exited. Press Enter to continue.")
          sys.exit(0)
  
      else:
          print('Unknown menu selection: %s' % m.returnkeyf menu_callback(m):
      '''called on menu selection'''
      if m.returnkey.startswith('# '):
          cmd = m.returnkey[2:]
          if m.handler is not None:
              if m.handler_result is None:
                  return
              cmd += m.handler_result
          process_stdin(cmd)
      elif m.returnkey == 'menuSettings':
          wxsettings.WXSettings(mestate.settings)
      elif m.returnkey.startswith("mode-"):
          idx = int(m.returnkey[5:])
          mestate.flightmode_selections[idx] = m.IsChecked()
      elif m.returnkey.startswith("loadLog"):
          print("File: " + m.returnkey[8:])
      elif m.returnkey == 'quit':
          mestate.console.close()
          mestate.exit = True
          print("Exited. Press Enter to continue.")
          sys.exit(0)
  
      else:
          print('Unknown menu selection: %s' % m.returnkey)
docs: called on menu selection