def METHOD_NAME():
    """Run the wx event loop by processing pending events only.
    This keeps processing pending events until stdin is ready.
    After processing all pending events, a call to time.sleep is inserted.
    This is needed, otherwise, CPU usage is at 100%.
    This sleep time should be tuned though for best performance.
    """
    # We need to protect against a user pressing Control-C when IPython is
    # idle and this is running. We trap KeyboardInterrupt and pass.
    try:
        app = wx.GetApp()
        if app is not None:
            assert wx.IsMainThread()
            if not callable(signal.getsignal(signal.SIGINT)):
                signal.signal(signal.SIGINT, signal.default_int_handler)
            evtloop = wx.GUIEventLoop()
            ea = wx.EventLoopActivator(evtloop)
            t = clock()
            while not stdin_ready() and not update_requested():
                while evtloop.Pending():
                    t = clock()
                    evtloop.Dispatch()
                if callable(getattr(app, 'ProcessIdle', None)):
                    app.ProcessIdle()
                if callable(getattr(evtloop, 'ProcessIdle', None)):
                    evtloop.ProcessIdle()
                # We need to sleep at this point to keep the idle CPU load
                # low.  However, if sleep to long, GUI response is poor.
                used_time = clock() - t
                ptime = 0.001
                if used_time >  0.10: ptime = 0.05
                if used_time >  3.00: ptime = 0.25
                if used_time > 30.00: ptime = 1.00
                sleep(ptime)
            del ea
            clear_update_request()
    except KeyboardInterrupt:
        if callable(ON_INTERRUPT):
            ON_INTERRUPT()
    return 0