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()

        

  • 相关阅读:
    重定向 重写
    php 安装 event 和 libevent 扩展
    curl 和 tcpdump
    yum 升级php版本
    shell 教程
    shell脚本 inotify + rsync 同步脚本
    nodesj中 中间件express-session的理解
    node.js中express-session配置项详解
    我对面向对象的理解
    BootstrapValidator
  • 原文地址:https://www.cnblogs.com/lkpp/p/7400054.html
Copyright © 2011-2022 走看看