- 首先打开qt designer,安装过程不赘诉,在安装完毕并添加到命令行之后。命令行输入。
. designer.exe
- 在qt designer新建ui文件并保存。
- 将ui文件编译成所需要的py文件
pyuic5 -o OnlineUpdateUI.py Online-Update.ui
- 为了方便今后ui文件的添加与修改,不推荐直接在生成的.py文件上进行开发,这里使用继承的方式来降低耦合性,在一定程度上实现分离。
这是我生成的OnlineUpdateUI.py文件
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Online-Update.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(406, 343)
self.UpdateButton = QtWidgets.QPushButton(Form)
self.UpdateButton.setGeometry(QtCore.QRect(260, 320, 131, 21))
self.UpdateButton.setObjectName("UpdateButton")
self.showup_textEdit