code: def inputhook_wx1():
      
      try:
          app = wx.GetApp()  # @UndefinedVariable
          if app is not None:
              assert wx.Thread_IsMain()  # @UndefinedVariable
  
              # Make a temporary event loop and process system events until
              # there are no more waiting, then allow idle events (which
              # will also deal with pending or posted wx events.)
              evtloop = wx.EventLoop()  # @UndefinedVariable
              ea = wx.EventLoopActivator(evtloop)  # @UndefinedVariable
              while evtloop.Pending():
                  evtloop.Dispatch()
              app.ProcessIdle()
              del ea
      except KeyboardInterrupt:
          pass
      return 0
docs: Run the wx event loop by processing pending events only.
  
      This approach seems to work, but its performance is not great as it
      relies on having PyOS_InputHook called regularly.