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

Peter Lipa porl3141 at hotmail.com
Wed Sep 11 18:04:00 BST 2002


Hi Gerard,

> WOW: I managed to delete the only QApplicationInstance (did I?), but the
> Python Shell did not crash.

As far as I understand your >>> del a;  deletes only the python shadow class
QApplication, but the
C++ QApplication (and the eventloop) are still referenced and running, bound
to the global qApp in the qt namespace.
Since I don't understand (at this point) what exactly sip is doing, I don't
have a clear picture what is
owned by whom and when the C++ qt objects (not the python shadow objects)
get deleted.
Guess I have to dig into sip....

> I suppose, that if the Python shell can look into the Python interpreter,
> the Python interpreter can look into the Python shell.

That would simplify things greatly. One can partly protect important object
intstances (qApp etc)
by hiding them from the namespace (with underscore names). Looks like this
solution is the way to go.


> Contact me, if you cannot get Boudewijn's idea working (leaves me some
time
> to polish the shell). This kind of META programming is fun, but I barely
> understand what I am doing :-)

I agree, you learn the guts of your tools when you do meta programming and
that is always a good
thing!
Please keep me posted on the progress you are making.

Cheers
Peter Lipa
porl3141 at hotmail.com
plipa at earthlink.net


----- Original Message -----
From: "Gerard Vermeulen" <gvermeul at grenoble.cnrs.fr>
To: "Peter Lipa" <porl3141 at hotmail.com>
Cc: "Gerard Vermeulen" <gvermeul at grenoble.cnrs.fr>; <pykde at mats.gmd.de>;
"Boudewijn Rempt" <boud at valdyas.org>; <phil at river-bank.demon.co.uk>;
<plipa at earthlink.net>; <thaneplummer at hotmail.com>
Sent: Wednesday, September 11, 2002 8:32 AM
Subject: Re: [PyKDE] How to do *INTERACTIVE* plotting with PyQt (or PyQwt)


> Hi Peter
> On Tue, Sep 10, 2002 at 04:36:19PM -0700, Peter Lipa wrote:
>
> [ snip ]
> >
> > Gerard's solution - to have a PyQt app shell running another instance of
the
> > interpreter inside is working! Thanks for your suggestions and sharing
the
> > testcode, Gerard! I really appreciate it!
> >
> > Comments to Gerard's solution:
> > It's great, it works, and is the obvious way to go ..., however, my
> > colleague  is developed already a python shell (called Neuralab) on
Windows
> > using MFC  and has the python interpreter embedded in C. Now we would
like
> > to run PyQt graphics within the this shell. Having another PyQt
interpreter
> > shell (pycute.py) running inside the C-embedded python shell is
possible,
> > but the communication then has to go through 2 layers of python
interpreters
> > (and makes things a little ugly, I guess). So this solution is perfect
if
> > one targets a PyQt shell or re-writes Neuralab in PyQt.  A good,
portable
> > opensouce PyQt shell would be of great benefit for everybody. (PyQt
crashes
> > the PythonWin shell from ActiveState, and does not integrate smoothly
into
> > wxWindows and Tkinter based shells either...)
> >
> I do not know if there are really two interpreters. It depends on how you
> look at it. I have a newer version of the Python shell (with more code
> stolen from Idle) that shares name space with the (main) Python
interpreter.
>
> I do not know if you want to give so much power to the users
> Here follows a little experiment (copy&paste):
>
> Python 2.2.1 (#1, May  8 2002, 22:31:32)
> [GCC 2.96 20000731 (Mandrake Linux 8.2 2.96-0.76mdk)] on linux-i386
> Type "copyright", "credits" or "license" for more information.
> >>> error
> Traceback (most recent call last):
>   File "<PQShell#0>", line 1, in ?
>     error
> NameError: name 'error' is not defined
> >>> a
> <qt.QApplication instance at 0x8170b74>
> >>> del a
> >>> a
> Traceback (most recent call last):
>   File "<PQShell#3>", line 1, in ?
>     a
> NameError: name 'a' is not defined
> >>>
>
> WOW: I managed to delete the only QApplicationInstance (did I?), but the
> Python Shell did not crash.
>
> I suppose, that if the Python shell can look into the Python interpreter,
> the Python interpreter can look into the Python shell.
>
> Contact me, if you cannot get Boudewijn's idea working (leaves me some
time
> to polish the shell). This kind of META programming is fun, but I barely
> understand what I am doing :-)
>
> Gerard
>
> PS: the version that you have, does not allow this. I have to figure out
why.
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.gmd.de
> http://mats.gmd.de/mailman/listinfo/pykde
>




More information about the PyQt mailing list