code: def inputhook_wx1(context):
      """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.
      """
      try:
          app = wx.GetApp()
          if app is not None:
              assert wx.Thread_IsMain()
  
              # 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()
              ea = wx.EventLoopActivator(evtloop)
              while evtloop.Pending():
                  evtloop.Dispatch()
              app.ProcessIdle()
              del ea
      except KeyboardInterrupt:
          pass
      return 0
  
file_path: catboost/contrib/python/ipython/py2/IPython/terminal/pt_inputhooks/wx.py
imports: from __future__ import absolute_import
  import sys
  import signal
  import time
  from timeit import default_timer
  import wx
label_desc: Use image node_id 1 for calling a global function with example usage: inputhook_wx1(context) and returns: int