[PyKDE] Qwt-0.3, Numerical Python, Black Adder, etc

Phil Thompson phil at river-bank.demon.co.uk
Tue Mar 6 10:21:23 GMT 2001


Gerard Vermeulen wrote:
> 
> Hi Phil, Mark
> 
> I have a set of alpha Python bindings to the Qwt-0.3 library.
> Qwt stands for "Qt Widgets for Technical applications" and
> version 0.3 works with Qt-2.x.
> 
> For more info: http://qwt.sourceforge.net/
> 
> Some of the code is stolen from Mark Colclough's bindings
> to Qwt-0.2 (which works with Qt-1.x)
> See http://www.cm.ph.bham.ac.uk/software/pyqt
> 
> One of my improvements is that it interfaces to the Numerical
> Python library, see http://numpy.sourceforge.net/
> This library allows you to manipulate arrays of numbers as
> if it were numbers (in MatLab style).
> 
> Example, the three lines:
> x = arrayrange(0.0, 100.0, 0.1)
> y = sin(x)
> z = cos(y)*exp(-x*x)
> creates an x array of 1000 numbers: 0.1, 0.2, 0.3,...
> and corresponding y and z arrays
> 
> The interface to Qwt solves one of the great weaknesses of
> Python on Linux: data plotting.
> 
> Question 1:
> To make this work, I have to add after the line:
> Py_InitModule("libqwtc",methods);
> import_array();
> in the initlibqwtc() function in qwtcmodule.cpp
> Is there a way to tell sip to do that automatically?
> (a kind of before-InitModule hook and after-InitModule hook)

If Qwt sub-classes from Qt widgets then this should be done
automatically if you have written the .sip files correctly. It's
actually done in the .py file.

Otherwise I'll have to add another directive to allow you to insert code
in the initlib function - but I'm not convinced its necessary. Why
couldn't you import it in qwt.py (which you can already add your own
code to from SIP).

> Question 2:
> I have installed Python-2.0 on my Mandrake-7.2 system and
> also boughth a personal edition of Black Adder.
> At least superficially, it looks like if there are
> name conflicts in /usr/lib/python2.0/site-packages
> Black Adder has:libbaqtcmodule.so*, qt.py
> PyQt has: libbqtcmodule.so*, and qt.py
> 
> Can I remove PyQt, rebuild my PyQwt using the .sip files
> of PyQt and expect that it will work with Black Adder?
> Or, if there is any NON-FREE code in libbaqtcmodule, could you
> split it up between a free PyQt part and a NON-FREE Black Adder
> part?

See the BlackAdder FAQ and README. The libbaqtc and libqtc modules have
the same functionality and each can replace the other - but they have
different licenses because libbaqtc includes Qt statically linked. All
of libbaqtc is non-free.

Phil




More information about the PyQt mailing list