[PyQt] Embedding Python in an exsting Qt application with PyQt?

Shaheed Haque srhaque at theiet.org
Mon Sep 11 08:46:14 BST 2017

On 10 September 2017 at 20:50, oliver <oliver.schoenborn at gmail.com> wrote:
> You don't necessarily need pyqt for this, it depends on your specifics. You
> would embed the interpreter the usual way, and would have a "terminal"
> window (QTextEdit or such) that has a REPL to interface with the embedded
> interpreter. You would expose *emergent* C++ classes to the Python
> interpreter via SWIG or sip. You would only need PyQt if you actually wanted
> to expose *Qt* classes in this scripting window, so the user can create
> custom classes deriving from QWidget etc, but if you just want to allow the
> user to instantiate pre-defined *emergent* GUI classes you should not need
> PyQt. If you do need PyQt, then it is probably wise to use sip (instead of
> SWIG) to expose *emergent* C++ classes. I would guess you will have to use
> compilation and linking flags/settings compatible with those of the sip you
> installed, or if that is not possible, you will have to build sip, Qt, and
> emergent from source.

You are welcome to browse the Python plugin for KDE's Kate here:

>From memory, the trickiest part was the conversion between QString and
Python 2 unicode/Python 3 str. The multiple versions for various
incarnations needed for 3 were particularly fiddly, but I think the
final formulation was pretty complete...

> Sounds like a fun project, good luck!
> On Sun, 10 Sep 2017 at 14:16 Brian Mingus <reflection at gmail.com> wrote:
>> I am looking to extend the Qt5 application emergent
>> (https://grey.colorado.edu/emergent) with a Python interpreter. Would it be
>> possible to use PyQt for this, and to also use that interpreter to program
>> emergent's Qt UI?
>> Thanks,
>> Brian
>> http://linkedin.com/in/brianmingus
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
> --
> Oliver
> My StackOverflow contributions
> My CodeProject articles
> My Github projects
> My SourceForget.net projects
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list