1.安裝
pip install pyqt5
2.開啟
3.繪製
4.執行
pyuic5 -x xxx.ui -o xxx.py
5.撰寫一個新的py檔案
from PyQt5 import QtWidgets, QtGui, QtCore
from xxx import Ui_MainWindow
import sys
class MainWindow(QtWidgets.QMainWindow):
def init(self):
super(MainWindow, self).init()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
# Menu
self.ui.pushButton.clicked.connect(self.btnclick) #按下按鈕後,會修改label 的 text 內容
def btnclick(self):
self.ui.label.setText("aaa") #
if name == ‘main’:
app = QtWidgets.QApplication([])
window = MainWindow()
window.show()
sys.exit(app.exec_())