Embedding python into PyQt

Grzegorz Dostatni grzegorz at ee.ualberta.ca
Mon May 3 11:01:50 EDT 2004


I am going to reply to my own message. That way, if someone else looks for
something similar - it'll be in the archives.

PyCute is part of a PyQwt project (available at sourceforge). It does
exactly what I want. I am using the PyCute3.py.

There is a small snag if you want to use it with a Qt designer. I solved
it by creating the following file: PyCute.py
---------------------------------------------------------
import PyCute3


class PyCute(PyCute3.PyCute):
    def __init__(self, parent, name):
        PyCute3.PyCute.__init__(self, parent=parent)
---------------------------------------------------------

After having that and the PyCute3.py in the same directory, just add a
custom widget to designer as class PyCute. and include the line:

Python:from PyCute import PyCute

in the comment field of the form settings.

Greg

Advice is what we ask for when we already know the answer but wish we
didn't.
          -- Erica Jong (How to Save Your Own Life, 1977)


On Fri, 30 Apr 2004, Grzegorz Dostatni wrote:

>
> Cheers.
> What I am trying to do is to embed the python interactive interpreter
> inside a qt TextEdit.
>
> I could write an event loop myself, but I was wandering if there exists a
> solution somewhere, or the best way to do it myself.
>
> Greg
>
> Advice is what we ask for when we already know the answer but wish we
> didn't.
>           -- Erica Jong (How to Save Your Own Life, 1977)
>
>
>
>




More information about the Python-list mailing list