[PyKDE] QImage to QPixmap conversion in a list comprehension
Alexander Borghgraef
alexander.borghgraef.rma at gmail.com
Mon Nov 7 14:37:20 GMT 2005
On 10/28/05, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> Yes there is. What do you mean by "doesn't work".
>
Sorry for not replying sooner, I was on vacation last week. By doesn't work
I mean returns the following error message:
TypeError: too many arguments to QPixmap(), 0 at most expected
Anyway, I found out why the code doesn't work: scipy.toimage returns a PIL
image object, not a QImage, silly me. The
function converting a scipy array into a QImage is not in the scipy library,
but in Qwt: qwt.toQImage. The following code
does work:
import scipy
import qwt
from qt import *
# imgList is a list of scipy arrays
pixmapList = [ QPixmap(qwt.toQImage(img)) for img in imgList ]
The typo in my first post was only in the post, not in my code, I used "from
scipy import *" there, just
thought it'd be clearer here to add the module name.
--
Alex Borghgraef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20051107/4706437b/attachment.html
More information about the PyQt
mailing list