[PyQt] Got error using QPixmap.fill

Phil Thompson phil at riverbankcomputing.com
Thu Nov 10 09:23:49 GMT 2016


On 10 Nov 2016, at 9:14 am, Gottfried Müller <gottfried.mueller at gmx.de> wrote:
> 
> I am using PyQt 5.7 and Qt 5.7 (Manjaro distribution):
> 
> I've got this error:
> 
> Traceback (most recent call last):
>  File "./testPixmapFill.py", line 27, in <module>
>    main()
>  File "./testPixmapFill.py", line 22, in main
>    mainWindow = MainWindow()
>  File "./testPixmapFill.py", line 17, in __init__
>    pixmap.fill(QColor.yellow)
> TypeError: fill(self, color: Union[QColor, Qt.GlobalColor, QGradient] = Qt.white): argument 1 has unexpected type 'builtin_function_or_method'
> 
> with the short script in the attachment. Is this my mistake?

Yes.

> An what is the solution. I know I can use QPainter. But I found this fill possibility in the C++ documentation of QPixmap.

You probably mean Qt.yellow.

Phil


More information about the PyQt mailing list