[PyKDE] QWidgetPlugin

Jim Bublitz jbublitz at nwinternet.com
Tue Jan 20 18:59:00 GMT 2004

On Tuesday January 20 2004 08:24, Roberto Alsina wrote:

> I want to make it easier for widgets written in python to be
> used from designer. While it is possible to use the regular
> "custom widget" dialog... well, it kinda sucks visually :-)

> So, the solution would be something using QWidgetPlugin.

> It seems what I would have to do is:

> * Create a QWidgetPlugin in C++
> * Make such QWidgetPlugin.create()
>   - load a python interpreter
>   - pass parent to it
>   - run a python script that creates the widget
>   - unload the interpreter.

> Is that possible?

> Such plugin could even be made almost automatically, since the
> only thing that changes is the 3-line python script it runs.

> Any ideas, suggestions.... working code? ;-)

Roland Schulz and some others were working on this and I believe 
have it mostly complete. I think the remaining problem was in 
loading a Python widget from an app with Python already running 
(using QWidgetFactory?) - the widget tries to load the Python 
interpreter itself, but gets the running version of Python and 
runs into thread state problems.

There is a library (libpythonize) which is common to all of the 
plugin type stuff (panel applets, KControl, QtDesigner, etc). 
It's basically just a simple wrapper around libpython.a, but in 
some cases it runs into problems that haven't been fixed yet.

Hopefully Roland's still on the list and can provide you more 
detail (and code?)


More information about the PyQt mailing list