IPython Documentation

Table Of Contents

Previous topic


Next topic


This Page


Module: lib.inputhookqt4

Qt4’s inputhook support function

Author: Christian Boos

IPython.lib.inputhookqt4.create_inputhook_qt4(mgr, app=None)

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

Parameters :

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.

Returns :

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.