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

设置图标
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}")

你可能感兴趣的:(python学习笔记)