From 244b0b50f90fa7c38fad9aebd09df61c238f8c6e Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 7 Jan 2025 17:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20pyqt5/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyqt5/README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pyqt5/README.md b/pyqt5/README.md index b2ac126..8057b00 100644 --- a/pyqt5/README.md +++ b/pyqt5/README.md @@ -4,9 +4,9 @@ 輸入指令 pip install pyqt5-tools -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%871.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%871.png) ### 並等待出現類似如下 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%872.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%872.png) ### 2. 設定QT Designer快速操作功能 1. 按下setting->Tools->External Tools @@ -16,7 +16,7 @@ 5. Arguments:$FileName$ 6. Working directory:$FileDir$ -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%873.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%873.png) ### *. 如果不知道Anaconda安裝路徑 1. 在windows底下找到anaconda Navigator @@ -24,50 +24,50 @@ 3. 選到anaconda Navigator右鍵->內容 4. 選擇開啟檔案位置即可知道anaconda安裝位置 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%874.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%874.png) ### 3. 設定UIC 1. 如果pyuic5在對應的路徑底下找不到 2. 請至anaconda資料夾底下直接搜尋 3. 並將對應的路徑填入Program中 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%875.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%875.png) ## ## UI 教學 ### 1. 創建一個UI介面 1. 在專案資料夾按下右鍵->External Tools->QtDesigner(此名稱會依據剛剛設定快速操作功能時名稱設定不同顯示不同) 2. 跳出最右邊的畫面即可開始編制UI介面 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%876.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%876.png) 3. 選擇MainWindows範本 4. 可從旁邊工具箱中拖曳所需之物件 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%877.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%877.png) ### 2. UI內部需注意之參數 1. 選擇到物件時即可查看此元件能設定之參數 2. 須注意objectName,python呼叫元件皆需要知道元件名稱,須清楚知道自己取了甚麼名稱 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%878.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%878.png) ### 3. 儲存UI畫面 1. 選擇到物件時即可查看此元件 2. 儲存名字隨興後續程式呼叫名稱統一即可 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%879.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%879.png) ### *. 佈局 畫面佈局使用Layouts與Spacers工具規劃,UI元件可動態變更大小 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8710.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8710.png) ### 4. 轉換UI畫面(.ui轉.py) 1. 回到專案資料夾中可以看到剛剛儲存的UI畫面 2. 右鍵->External Tools->UIC 3. 此時會出現一個依樣名稱的py檔,此檔案即為後續程式呼叫所需之檔案 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8711.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8711.png) ## ## 執行 @@ -76,17 +76,17 @@ 2. 創建一個主py檔 3. 資料夾底下最少需要3個檔案 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8712.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8712.png) ### 主程式內部 * 呼叫剛剛建立的UI至主程式中,須注意名稱需要一樣 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8713.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8713.png) ### 按鈕觸發 1. 呼叫UI上對應的按鈕 2. 設定按鈕點即時的動作 -![](http://140.125.21.65:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8714.png) +![](http://leovip125.ddns.net:8418/Education/Python/raw/branch/master/pyqt5/img/%E5%9C%96%E7%89%8714.png)