[PyQt] Qt.color in pixel

Phil Thompson phil at riverbankcomputing.com
Sat Apr 5 11:00:25 BST 2008


On Saturday 05 April 2008, Grissiom wrote:
> Hello,
>
> I'm a absolute newbie(new to Python and new to Qt). When I run this
> program:
>
> #file test2.py
> from PyQt4 import QtCore, QtGui
>
> print 'QtCore.Qt.color1 is', (QtCore.Qt.color1)
> mono_im = QtGui.QImage(10, 10, QtGui.QImage.Format_Mono)
> mono_im.setPixel(5, 5, QtCore.Qt.color1)
> print 'QtCore.Qt.color1 in pixel is', mono_im.pixel(5, 5)
> #EOF
>
> I got this :
>
> bash-3.1$ python test2.py
> QtCore.Qt.color1 is 1
> QtCore.Qt.color1 in pixel is 4294967295
>
> Could anyone explain how could '1' became '4294967295'? Thanks in advance
> ;)

According to the docs...

For bitmaps setPixel() takes an index into the colour table. pixel() returns a 
QRgb and not an index.

Phil


More information about the PyQt mailing list