zoukankan      html  css  js  c++  java
  • PyQt5--QFontDiaglog

     1 # -*- coding:utf-8 -*-
     2 '''
     3 Created on Sep 17, 2018
     4 
     5 @author: SaShuangYiBing
     6 
     7 Comment: 
     8 '''
     9 import sys
    10 from PyQt5.QtWidgets import QApplication,QWidget,QFontDialog,QLabel,QVBoxLayout,QPushButton,QSizePolicy
    11 
    12 class New_test(QWidget):
    13     def __init__(self):
    14         super().__init__()
    15         self.initUI()
    16     
    17     def initUI(self):
    18         vbox = QVBoxLayout()
    19         
    20         btn = QPushButton('Diaglog',self)
    21         btn.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
    22         btn.move(20,20)
    23         btn.clicked.connect(self.showdiaglog)
    24         
    25         self.lbl = QLabel('Knowledge only matters',self)
    26         self.lbl.move(150,20)
    27         
    28         vbox.addWidget(btn)
    29         vbox.addWidget(self.lbl)
    30         self.setLayout(vbox)
    31         
    32         self.setGeometry(300,300,250,180)
    33         self.setWindowTitle('Font Diaglog')
    34         self.show()
    35         
    36     def showdiaglog(self):
    37         font,ok = QFontDialog.getFont()
    38         if ok:
    39             self.lbl.setFont(font)
    40             
    41 if __name__ == '__main__':
    42     app = QApplication(sys.argv)
    43     ex = New_test()
    44     sys.exit(app.exec_())        

  • 相关阅读:
    #define中的特殊符号
    c++ windows下计时
    c++内存池
    u3d 场景资源打包
    Unity3d 动态加载材质方法
    Unity3D Shader基础教程
    Unity3D Shader入门指南(一)
    Unreal发展史
    阴影锥(shadow volume)原理与展望
    软硬RAID 和 不常见的RAID
  • 原文地址:https://www.cnblogs.com/aziji/p/9678970.html
Copyright © 2011-2022 走看看