[PyKDE] How to do *INTERACTIVE* plotting with PyQt (or PyQwt)

Gerard Vermeulen gvermeul at grenoble.cnrs.fr
Mon Sep 9 09:12:01 BST 2002


On Fri, Sep 06, 2002 at 06:21:16PM -0700, Peter Lipa wrote:
> Hi Guys (Phil, Gerard and Boudewijn),
> Thanks so much for your replies - I really appreciate any help or
> suggestion. Unfortunatley I am still desparate....
> I seems to me, that only Gerard Vermeulen understood fully what I *need* to
> do (since he tried  that before).
> I looked a bit at eric and this is not quite what I want (it is a qt app
> with a single qApp in the main thread and runs
> a independent - and isolated- python shell inside which in turn can run a
> single Qt app to be debugged).
> My problem is the other way round. I want to run several Qt windows and send
> commands via the interpreter to these
> windows, such as, add a line (xarray,yarray) to the current axes ).

Here you have a little PyQt Python shell (can be integrate in any application),
called PyCute. It is still in the proof of concept stage, but it works
with some limitations.

Cut&paste from PyCute follows:
Python 2.2.1 (#1, Aug 28 2002, 08:16:58)
[GCC 2.95.3 20010315 (release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> from Numeric import *
>>> from plot import *
>>> x = arange(-2*pi, 2*pi, 0.01)
>>> y1 = sin(x)
>>> y2 = cos(x)
>>> c1 = Curve(x, y1, red, "sin(x)")
>>> c2 = Curve(x, y2, blue, "cos(x)")
>>> p = Plot(title="Plot generated from PyCute", curves=[c1, c2])

It initializes x-axis data from -2*pi to 2*pi with steps of 0.01 and
calculates the sine and cosine.

The plot module is sugar coating for my wrappers of the Qwt C++ library.
The curves c1 and c2 have x-data, y-data, color and a legend label
The last statement creates a plot and shows it.

Screenshots are included in the tarball

Regards Gerard.

PS: PyCute needs still quite a lot of work. You can steal ideas from
PyShell.py (the idle environment that uses Tkinter), code.py (the Python
library) and eric (PyQt's debugger).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PyCute-20020908.tar.gz
Type: application/octet-stream
Size: 14393 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020909/7400a7cb/PyCute-20020908.tar.obj

More information about the PyQt mailing list