Sivo 悉见

2、PyQt5生成的一个简单GUI

匿名 · 更新于 2018/3/3

# -*- coding: utf-8 -*-

Form implementation generated from reading ui file 't1.ui'

Created by: PyQt5 UI code generator 5.10.1

WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Myui(object):     def setupUi(self, Myui):         Myui.setObjectName("Myui")         Myui.resize(400, 300)         self.buttonBox = QtWidgets.QDialogButtonBox(Myui)         self.buttonBox.setGeometry(QtCore.QRect(30, 240, 341, 32))         self.buttonBox.setOrientation(QtCore.Qt.Horizontal)         self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)         self.buttonBox.setObjectName("buttonBox")

        self.retranslateUi(Myui)         # self.buttonBox.accepted.connect(Myui.accept)         # self.buttonBox.rejected.connect(Myui.reject)         QtCore.QMetaObject.connectSlotsByName(Myui)

    def retranslateUi(self, Myui):         _translate = QtCore.QCoreApplication.translate         Myui.setWindowTitle(_translate("Myui", "Dialog"))

if name == "main":     import sys     app = QtWidgets.QApplication(sys.argv)     MainWindow = QtWidgets.QMainWindow()     ui = Ui_Myui()     ui.setupUi(MainWindow)     MainWindow.show()     sys.exit(app.exec_())