zoukankan      html  css  js  c++  java
  • pyqt5和qtdesign的使用

    http://blog.csdn.net/Angelasan/article/details/44917283

    发现我的使用时候有点跟他不同.

    我是

    g: utf-8 -*-
    
    # Form implementation generated from reading ui file '1.ui'
    #
    # Created by: PyQt5 UI code generator 5.6
    #
    # WARNING! All changes made in this file will be lost!
    
    from PyQt5 import QtCore, QtGui, QtWidgets
    from PyQt5.QtCore import *
    from PyQt5.QtWidgets import * 
    class Ui_Dialog(object):
        def setupUi(self, Dialog):
            Dialog.setObjectName("Dialog")
            Dialog.resize(813, 703)
            self.textEdit = QtWidgets.QTextEdit(Dialog)
            self.textEdit.setGeometry(QtCore.QRect(80, 120, 671, 421))
            self.textEdit.setObjectName("textEdit")
    
            self.retranslateUi(Dialog)
            QtCore.QMetaObject.connectSlotsByName(Dialog)
            Dialog.show()
        def retranslateUi(self, Dialog):
            _translate = QtCore.QCoreApplication.translate
            Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
    if __name__ == "__main__":
        import sys
        app = QApplication(sys.argv)
        widget = QWidget(None)
        Ui_Dialog().setupUi(widget)
        sys.exit(app.exec_())
        pass

    也就是第五步从1.py进行修改:1.在setupUi里面最后一行写的是Dialog.show()  2.最后贴上 

    if __name__ == "__main__":
        import sys
        app = QApplication(sys.argv)
        widget = QWidget(None)
        Ui_Dialog().setupUi(widget)
        sys.exit(app.exec_())
        pass
    

    就可以了.

    原因就是qtdesingner不给写这个class的show,也缺少if main这些东西,然后实例化的时候需要自己看着改,我这里的class是

    Ui_Dialog.所以倒数第三行是他加()
  • 相关阅读:
    Difference between Nested & Correlated Subqueries
    Oracle Btree、位图、全文索引三大索引性能比较及优缺点汇总(转载)
    subquery unnesting、Subquery unnesting and View Merge
    MySQL中如何定义外键[转]
    索引1
    创建索引和索引类型
    UpdatePanel的用法详解
    索引2
    [HTTP]GET 和POST的区别
    [转]解决silverlight引用中文字体的问题
  • 原文地址:https://www.cnblogs.com/zhangbo2008/p/8459528.html
Copyright © 2011-2022 走看看