(七 美化-1)PyQT5 button style

刘月玮IP属地: 北京
0.144字数 35阅读 8,017

设置 QPushButton 样式及点击时 QPushButton:pressed 的样式

代码示例

button.setStyleSheet(''' 
                     QPushButton
                     {text-align : center;
                     background-color : white;
                     font: bold;
                     border-color: gray;
                     border-width: 2px;
                     border-radius: 10px;
                     padding: 6px;
                     height : 14px;
                     border-style: outset;
                     font : 14px;}
                     QPushButton:pressed
                     {text-align : center;
                     background-color : light gray;
                     font: bold;
                     border-color: gray;
                     border-width: 2px;
                     border-radius: 10px;
                     padding: 6px;
                     height : 14px;
                     border-style: outset;
                     font : 14px;}
                     ''')

参考链接

http://doc.qt.io/archives/qt-4.8/stylesheet-examples.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
1人点赞
更多精彩内容,就在简书APP
"小礼物走一走,来简书关注我"
还没有人赞赏,支持一下
刘月玮什么工种都做过了,也是很尴尬。
总资产3共写了4.1W字获得117个赞共80个粉丝

推荐阅读更多精彩内容