[PyKDE] question re QImage.setPixel in PyQt3
Tony Willis
Tony.Willis at nrc-cnrc.gc.ca
Fri Mar 10 17:36:00 GMT 2006
Hi
I'm using PyQt3.13 and have run across a problem with the
python interface to the QImage setPixel method. You can see this
directly by replacing line 90 of examples3/desktop.py
image.setPixel(x,y,(x+y)%128)
by
image.setPixel(x,y, qRgb(x,y,0))
this will result in error messsages such as
Image::setPixel: index=-16050688 out of range
A call to Qimage.setColor with a qRgb object does work.
The problem is that the setPixel method is expecting an
unsigned int - the call in the original demo will work
because (x+y)%128 will not get near the sign bit for a
python int, whereas qRgb(x,y,0) can return an unsigned
value > the range of a python int.
I see that qimage.sip has void setPixel(int,int,uint);
whereas it has void setColor(int,QRgb);
Thanks for any advice on how to get around this problem.
Cheers
Tony
___________
Tony Willis
National Research Council Tony.Willis at nrc-cnrc.gc.ca
Box 248 (250)493-2277
Penticton, BC V2A 6J9 fax: 493-7767
Government of Canada Gouvernement du Canada
More information about the PyQt
mailing list