def inputhook(context):
    def _main_quit(*a, **kw):
        gtk.main_quit()
        return False

    gobject.io_add_watch(context.fileno(), gobject.IO_IN, _main_quit)
    gtk.main()
When the eventloop of prompt-toolkit is idle, call this inputhook.
dataset/ETHPy150Open jonathanslenders/python-prompt-toolkit/examples/inputhook.py/inputhook