简体   繁体   中英

PyQt5 - How to set QPixmap to black?

I've recently started to learn PyQt5 a bit.

But I'm struggling to set a QPixmap to fully black.

Is there any QPixmap function on how to set it to black?

For example something like self.screen.setPixmap() ?

Solved the issue like suggested by musicamente using pixmap.fill(Qt.black) :

from PyQt5.QtCore import *

pixmap = QPixmap(16,16)
pixmap.fill(Qt.black)  #  fill the map with black

self.screen.setPixmap(pixmap)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM