PyQt with embedded python in Qt App

David Boddie david at boddie.org.uk
Fri Nov 2 15:25:51 CET 2007


On Fri Nov 2 12:59:48 CET 2007, Bart. wrote:

> Or I want to use PyQt in scripts to have similar gui for plugins written in
> python
> Or I want to extend application  by scripts with PyQt.
> 
> Or better question:
> How to easy add python scripting in Qt application and have almast all
> objects of app accesible in scripts?
> Kross could be good solution?

You can use PyQt, Kross or PythonQt for this, but only PyQt will give you
a comprehensive API "out of the box".

There is code in the PyQt source distribution that shows how to set up the
Python interpreter inside a C++ plugin and import modules - it's used to
load custom Python widgets into Qt Designer.

Look at the designer/pluginloader.cpp file to get an idea of what you need
to do. There are simpler ways to initialize Python, but this code should
be helpful if you want to extend what you've done at a later time.

David



More information about the Python-list mailing list