Qt4’s inputhook support function

Author: Christian Boos

This file is copied from https://github.com/ipython/ipython/blob/66c77ff392ad7425f8443e1343f5bf8c84a7b5d7/IPython/lib/inputhookqt4.py for internal use in Woo.

woo.ipythonintegration.create_inputhook_qt4(mgr, app=None)[source]

Create an input hook for running the Qt4 application event loop.

  • mgr – an InputHookManager
  • app – Qt Application, optional. Running application to use. If not given, we probe Qt for an existing application object, and create a new one if none is found.

A pair consisting of a Qt Application (either the one given or the one found or created) and a inputhook.


We use a custom input hook instead of PyQt4’s default one, as it interacts better with the readline packages (issue #481).

The inputhook function works in tandem with a ‘pre_prompt_hook’ which automatically restores the hook as an inputhook in case the latter has been temporarily disabled after having intercepted a KeyboardInterrupt.



Ask questions or report issues at github.