[PyQt] PyQt4 interactive on Windows and Unix without readline

Giovanni Bajo rasky at develer.com
Sat Jul 7 22:01:09 BST 2007


On 07/07/2007 10.23, Michiel De Hoon wrote:

> static int qtcore_input_hook()
> {
>     QCoreApplication::processEvents();
>     QCoreApplication* app = QCoreApplication::instance();
>     if (!app) return 0;
>     while (1)
>     {
>         QTimer timer;
>         QObject::connect(&timer, SIGNAL(timeout()), app, SLOT(quit()));
>         timer.start(100);
>         QCoreApplication::exec();
>         timer.stop();
>         QObject::disconnect(&timer, SIGNAL(timeout()), app, SLOT(quit()));
>         if (_kbhit()) return 0;
>     }
> }

FWIW, I'm +1 on this. It's a problem within Python proper of course (it should 
be calling PyOS_InputHook with the same semantic irrespective of the presence 
of a readline module), but it's totally hopeless to see it fixed in Python 2.x 
(see some related SF.NET bugs for more infos).

Thus, it looks like this workaround is the only stop-gap. TkInter does the 
same, after all.
-- 
Giovanni Bajo



More information about the PyQt mailing list