zoukankan      html  css  js  c++  java
  • PyQt4简单小demo

    #coding=utf-8
    
    import sys
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *
    
    class FontPropertiesDlg(QDialog):
    
        #初始化
        def __init__(self,parent=None):
            #super函数完成对话框的初始化
            super(FontPropertiesDlg,self).__init__(parent)
            FontStyleLabel =QLabel(u'中文字体:')
            FontStyleComboBox=QComboBox()
            FontStyleComboBox.addItems([u'宋体',u'黑体',u'仿宋',u'隶书',u'楷体'])
            FontSizeLabel =QLabel(u'字体大小')
            FontSizeSpinBox=QSpinBox()
            FontSizeSpinBox.setRange(0,90)
            FontEffectCheckBox=QCheckBox(u'使用特效')
            okButton=QPushButton(u'确定')
            cancelButton=QPushButton(u'取消')
            #确认控件的布局
            buttonLayout=QHBoxLayout()
            buttonLayout.addStretch()
            buttonLayout.addWidget(okButton)
            buttonLayout.addWidget(cancelButton)
            layout=QGridLayout()
            layout.addWidget(FontStyleLabel,0,0)
            layout.addWidget(FontStyleComboBox,0,1)
            layout.addWidget(FontSizeLabel,1,0)
            layout.addWidget(FontSizeSpinBox,1,1)
            layout.addWidget(FontEffectCheckBox,1,2)
            layout.addLayout(buttonLayout,2,0,1,3)
            self.setLayout(layout)
            #窗口的标题
            self.setWindowTitle(u'字体')
    
    if __name__=='__main__':
        app=QApplication(sys.argv)
        font=FontPropertiesDlg()
        font.show()
        app.exec()

        

  • 相关阅读:
    设计模式基本原则及实例
    Springboot中发送邮件util
    mysql表关联查询索引不生效问题
    个人读书清单整理
    mysql 显示每条记录行号
    Axure教程
    Tomcat配置及原理文章
    HTTPS 简单学习
    Python实现二叉树的非递归先序遍历
    和HTTP相关的web服务器内容
  • 原文地址:https://www.cnblogs.com/lkpp/p/7400054.html
Copyright © 2011-2022 走看看