From e64c0fa11787e5906cc9c3e67d485673afa2cbbd 2013-02-21 00:11:38 From: Brian E. Granger Date: 2013-02-21 00:11:38 Subject: [PATCH] Merge pull request #2901 from lessandro/osx_inputhook_wx Fix inputhook_wx on osx --- diff --git a/IPython/lib/inputhookwx.py b/IPython/lib/inputhookwx.py index eaf87bd..2bacb71 100644 --- a/IPython/lib/inputhookwx.py +++ b/IPython/lib/inputhookwx.py @@ -17,6 +17,7 @@ Authors: Robin Dunn, Brian Granger, Ondrej Certik # Imports #----------------------------------------------------------------------------- +import sys import signal import time from timeit import default_timer as clock @@ -159,5 +160,11 @@ def inputhook_wx3(): pass return 0 -# This is our default implementation -inputhook_wx = inputhook_wx3 +if sys.platform == 'darwin': + # On OSX, evtloop.Pending() always returns True, regardless of there being + # any events pending. As such we can't use implementations 1 or 3 of the + # inputhook as those depend on a pending/dispatch loop. + inputhook_wx = inputhook_wx2 +else: + # This is our default implementation + inputhook_wx = inputhook_wx3