[PyKDE] QImage to QPixmap conversion in a list comprehension

Alexander Borghgraef alexander.borghgraef.rma at gmail.com
Fri Oct 28 15:15:24 BST 2005


Hi all,

I'm trying to convert a list of scipy arrays to a list of QPixmap objects.
Scipy contains a function
"toimage" which converts an array (matrix actually) to a QImage object so my
naive implementation was

import scipy
from qt import *

# imgList is a list of scipy arrays
pixmapList = [ QPixmap(scip.toimage(img)) for img in imgList ]

 Apparently, this doesn't work, there's no such constructor equivalent to
the C++ version. I know of
QPixmap.convertFromImage, but that implies creating an empty QPixmap object
first, then reading
the QImage object returned by scipy into it, which pretty much precludes the
elegant list comprehension
solution. Any suggestions for a better solution?

--
Alex Borghgraef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20051028/7cb4b2e8/attachment.html


More information about the PyQt mailing list