PyQTt5逻辑和界面分离

2022/5/26 posts

# PyQt5逻辑和界面分离

from PyQt5 import QtCore, QtGui, QtWidgets
from untitled import Ui_MainWindow
import sys

if __name__ == "__main__":
  app = QtWidgets.QApplication(sys.argv)
  app.setStyle("Fusion")  # 设置窗口风格
  MainWindow = QtWidgets.QMainWindow() # 创建窗体对象
  ui = Ui_MainWindow()  # 创建PyQt设计的窗体对象
  ui.setupUi(MainWindow)  # 对窗体对象进行初始化设置
  MainWindow.show() # 显示窗体
  sys.exit(app.exec_())