QWidget设置背景色

QWidget设置背景色

  1. 通过QPalette设置

    self.setAutoFillBackground(True)
    palette = QPalette()
    palette.setColor(QPalette.Background, QColor(0, 0, 0))
  2. 通过StyleSheet设置

    mainWindowColor="background-color:#37474F"
    self.setStyleSheet(mainWindowColor)

猜你喜欢

转载自blog.csdn.net/zycxnanwang/article/details/82147765