[PyKDE] ANNOUNCE: IQtPy for event handling by Python's read-eval-print loop

Gerard Vermeulen gvermeul at grenoble.cnrs.fr
Sun Feb 23 19:02:01 GMT 2003


Hi,

I am using this little toy for a week and I can't miss it anymore:

it allows me to use the standard Python interpreter running in an
xterm/Eterm/konsole to create and control PyQt widgets, and to use
the widgets at the same time as in a standard GUI program.

You can get this little toy (less 100 lines of C++ code including
a lot of comments and whitespace) from
http://gerard.vermeulen.free.fr/index.html#IQtPy

Name: IQtPy
Version: 0.1
Summary: Tool to control PyQt widgets from Python running in a terminal
Home-page: http://gerard.vermeulen.free.fr
Author: Gerard Vermeulen
Author-email: gvermeul at grenoble dot cnrs dot fr
License: LGPL
Description:
        IQtPy enables you to create and control PyQt widgets from the
        Python interpreter (or IPython) running in a text terminal.

        The programming style 'imposed' by PyQt (and other GUI toolkits) is
        to create an application instance, some widgets and to enter into
        an event loop that locks YOU from the terminal. IQtPy gives you both
        worlds: you can type Python statements in the interpreter and interact
        with your widgets at the same time.

        IQtPy works by hooking a function handling a limited number of events
        on the event hook of the readline module. The GNU readline library
        closes the event loop by calling the hooked function at a maximum
        rate of 10 times per second while reading your keyboard input.

        This method can be applied to any GUI toolkit that permits to process
        events out of the main event loop and any Python interpreter with a
        decent readline module.
        ;-) Oh Bill, this seems to exclude Python compiled with MSVC ;-)

        The following example displays 100 working clocks:

        packer:~/IQtPy-0.1$ python
        Python 2.2.2 (#1, Nov  2 2002, 15:17:50)
        [GCC 2.95.3 20010315 (release)] on linux2
        Type "help", "copyright", "credits" or "license" for more information.
        >>> import iqt, aclock
        >>> list = []
        >>> for i in range(100): list.append(aclock.clock())
        ...
        >>> Ctrl-D
        packer:~/IQtPy-0.1$

Platform: Unix

Happy hacking -- Gerard




More information about the PyQt mailing list