博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PyQt5字体对话框
阅读量:3898 次
发布时间:2019-05-23

本文共 862 字,大约阅读时间需要 2 分钟。

import sysfrom PyQt5.QtWidgets import *from PyQt5.QtCore import *from PyQt5.QtGui import *class QFontDialogDemo(QWidget):    def __init__(self):        super(QFontDialogDemo,self).__init__()        self.initUI()    def initUI(self):        self.setWindowTitle('Font Dialog案例')        self.resize(300,200)        layout =QVBoxLayout()        self.fontbtn = QPushButton('选择字体')        self.fontbtn.clicked.connect(self.getFont)        self.fontlabel =QLabel('测试字体')        self.fontlabel.setAlignment(Qt.AlignCenter)        layout.addWidget(self.fontbtn)        layout.addWidget(self.fontlabel)        self.setLayout(layout)    def getFont(self):        font,ok = QFontDialog.getFont()        if ok:            self.fontlabel.setFont(font)if __name__ == '__main__':    app =QApplication(sys.argv)    main = QFontDialogDemo()    main.show()    app.exit(app.exec_())

在这里插入图片描述

转载地址:http://eoben.baihongyu.com/

你可能感兴趣的文章
(3年+offer)华为技术岗面试初面+综合面试经验总结
查看>>
男默女泪,努力复习的我终于通过社招进入BAT工作了!(JAVA+JVM+框架+中间件+Spring干货分享)
查看>>
Python 导包
查看>>
dok_matrix
查看>>
theano 后端爆内存
查看>>
os.environ 和 keras.json
查看>>
后台面试经典问题-手写LRU算法
查看>>
Part-Guided Attention Learning for Vehicle Instance Retrieval
查看>>
Deep Residual Learning for Image Recognition
查看>>
Bag of Tricks and A Strong Baseline for Deep Person Re-identification
查看>>
vue+flask实现视频目标检测yolov5
查看>>
关于BigInteger
查看>>
UIScrollView不能响应UITouch事件
查看>>
iOS TextFiled 文本密码切换 光标偏移解决
查看>>
iOS 当前应用所占内存和设备可用内存
查看>>
iOS 文件属性
查看>>
UIView的layoutSubviews和drawRect方法何时调用
查看>>
iOS GCD多线程下载原理
查看>>
NSData全部API解释
查看>>
iOS 侧滑菜单封装Demo(类似QQ侧滑效果)
查看>>