当前位置:主页 > 软件编程 > Python代码 >

用pyqt5 给按钮设置图标和css样式的方法

时间:2021-05-25 08:22:43 | 栏目:Python代码 | 点击:

如下所示:

设置图标

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}")

您可能感兴趣的文章:

相关文章