### 參考文獻 [嗡嗡的隨手筆記-pyQT](https://www.wongwonggoods.com/all-posts/python/python-image-process/pyqt5/pyqt5-1/) [STEAM 教育學習網](https://steam.oxxostudio.tw/) [汪群超 Chun-Chao Wang - Python in Learning](https://ntpuccw.blog/python-in-learning/) [練習程式](https://github.com/ShinWeiPeng/PyQT-Practice) ### 安裝工具 [Qt for Python](https://marketplace.visualstudio.com/items?itemName=seanwu.vscode-qt-for-python) [Qt Designer](https://build-system.fman.io/qt-designer-download) ``` py -m pip install PyQt5 pyqtgraph py -m pip install pyqt5-tools //僅支援到python 3.11.13 py -m pip install opencv-python opencv-contrib-python ``` ### 設置PATH路徑 ``` C:\Users\{使用者名稱}\AppData\Local\Programs\Python\Python313\Scripts ``` ![環境變數](https://hackmd.io/_uploads/r183CF-Vex.png) ### 測試程式 ``` import sys from PyQt5.QtWidgets import QApplication, QWidget, QLabel from PyQt5.QtGui import QIcon from PyQt5.QtCore import pyqtSlot def window(): app = QApplication(sys.argv) widget = QWidget() textLabel = QLabel(widget) textLabel.setText("Hello World!") textLabel.move(110,85) widget.setGeometry(50,50,320,200) widget.setWindowTitle("PyQt5 Example") widget.show() sys.exit(app.exec_()) if __name__ == '__main__': window() ``` ![測試畫面](https://hackmd.io/_uploads/Hk2L3FWNle.png) ### 透過.ui產生.py檔案 ``` pyuic5 -x example.ui -o example_ui.py ```