为什么我不能设置QPushButton的颜色?

时间:2018-10-02 01:22:05

标签: python pyqt pyqt5

根据文档,可以这样设置文本和背景的颜色:

button.setStyleSheet('QPushButton {color: #ffcc00; background-color: black;}')

不过这是我看到的:

enter image description here

背景保持白色。我这样生成整个按钮:

button = QPushButton('Clear Knots')
button.clicked.connect(canvas.clear)
button.setStyleSheet('QPushButton {color: #ffcc00; background-color: black;}')

0 个答案:

没有答案