[PyKDE] QImage to QPixmap conversion in a list comprehension
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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt