更新时间:2022-12-11 20:22:55
QWidget
子类默认会忽略样式表(出于性能原因).
A QWidget
subclass will ignore stylesheets by default (for performance reasons).
试试这个:
w = Canvas(outer)
w.setAttribute(QtCore.Qt.WA_StyledBackground)
w.setStyleSheet("background-color: black")