通过PyQt5提供的命令行工具

  1. pyuic5 -o BaiduAD.py BaiduAD.ui

在py 显示 UI代码

  1. from PyQt5 import QtCore, QtGui, QtWidgets
  2. import sys
  3. from PyQt5.QtWidgets import QMainWindow
  4. if __name__ == "__main__":
  5. app = QtWidgets.QApplication(sys.argv)
  6. form = QtWidgets.QWidget()
  7. w = Ui_Form()
  8. w.setupUi(form)
  9. form.show()
  10. sys.exit(app.exec_())