4 Star 21 Fork 9

木子/PyQt_practice

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
01-QFontDialog-创建.py 700 Bytes
一键复制 编辑 原始数据 按行查看 历史
木子 提交于 2022-02-21 20:53 +08:00 . Reformat code with isort
import sys
from PyQt5.Qt import *
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("QFontDialog")
self.resize(500, 500)
self.move(400, 250)
self.setup_ui()
def setup_ui(self):
btn = QPushButton("测试按钮", self)
btn.move(100, 100)
btn.clicked.connect(lambda: fd.open())
font = QFont()
font.setFamily("宋体")
font.setPointSize(22)
fd = QFontDialog(font, self) # 可以在创建时传入一个QFont对象作为默认字体
if __name__ == "__main__":
app = QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec_())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/muzing/PyQt_practice.git
git@gitee.com:muzing/PyQt_practice.git
muzing
PyQt_practice
PyQt_practice
master

搜索帮助