def qt4():
 try:
  allow_CTRL_C()
  app = QtCore.QCoreApplication.instance()
  if (not app):
   return 0
  app.processEvents(QtCore.QEventLoop.AllEvents, 300)
  if (not stdin_ready()):
   timer = QtCore.QTimer()
   event_loop = QtCore.QEventLoop()
   timer.timeout.connect(event_loop.quit)
   while (not stdin_ready()):
    timer.start(50)
    event_loop.exec_()
    timer.stop()
 except KeyboardInterrupt:
  print '\nKeyboardInterrupt - Press Enter for new prompt'
 except:
  ignore_CTRL_C()
  from traceback import print_exc
  print_exc()
  print 'Got exception from inputhook, unregistering.'
  clear_inputhook()
 finally:
  allow_CTRL_C()
 return 0

def qt4 ( ) : try : allow_CTRL_C ( ) app = QtCore . QCoreApplication . instance ( ) if ( not app ) : return 0 app . processEvents ( QtCore . QEventLoop . AllEvents , 300 ) if ( not stdin_ready ( ) ) : timer = QtCore . QTimer ( ) event_loop = QtCore . QEventLoop ( ) timer . timeout . connect ( event_loop . quit ) while ( not stdin_ready ( ) ) : timer . start ( 50 ) event_loop . exec_ ( ) timer . stop ( ) except KeyboardInterrupt : print '\nKeyboardInterrupt - Press Enter for new prompt' except : ignore_CTRL_C ( ) from traceback import print_exc print_exc ( ) print 'Got exception from inputhook, unregistering.' clear_inputhook ( ) finally : allow_CTRL_C ( ) return 0
pyos_inputhook python hook for qt4 .