0
奇妙なことに、私はPyQtアプリケーションで透明度を含む背景を正常に追加していますが、画像の多くは黒いままです。PyQt透明な背景画像部分的に黒色
from PyQt4.QtGui import *
import sys
class BackgroundIssue(QMainWindow):
def __init__(self):
super(BackgroundIssue, self).__init__()
def resizeEvent(self, event):
pixmap = QPixmap("res/background.png")
region = QRegion(pixmap.mask())
self.setMask(pixmap.mask())
def main():
app = QApplication(sys.argv)
window = BackgroundIssue()
palette = QPalette()
palette.setBrush(QPalette.Background,QBrush(QPixmap("res/background.png")))
window.setPalette(palette)
window.setWindowTitle("Partially Black Background Image")
window.show()
return app.exec_()
if __name__ == '__main__':
main()
実際の画像はthisのように見えながら、結果はthisあります。 (最初のリンクの白が正しく透明に機能していることに注意してください)
私はすべてを見て、これ以上頭を悩まし、十数個の解決策を試しました。誰でもこの現象が呼ばれていることを少なくとも説明することはできますか?
ありがとうございます!