当前位置: 代码迷 >> 综合 >> pyqt5 给按钮设置图标和css样式
  详细解决方案

pyqt5 给按钮设置图标和css样式

热度:68   发布时间:2024-03-06 20:13:39.0

设置图标
self.pushButton.setIcon(QIcon("sure.png"))

设置css样式

self.pushButton.setStyleSheet("QPushButton{color:black}"
"QPushButton:hover{color:red}"
"QPushButton{background-color:lightgreen}"
"QPushButton{border:2px}"
"QPushButton{border-radius:10px}"
"QPushButton{padding:2px 4px}")

 

button in messagebox is still can be set its icon and css style.