PyCharm 內執行 QT Designer 和 ui 轉 py

看了幾篇文章都有些疏漏,並沒有辦法真正的做到直接在程式內直接呼叫 External tool 做到這兩件事

都會有一些錯誤訊息

我的環境是 Ubuntu 18.04 ,用 snap 安裝的 PyCharm
順便安裝 QT 相關的環境

$ sudo snap install pycharm-community --classic
$ sudo sudo apt install  pyqt5-dev-tools python3-pyqt5 qttools5-dev-tools

到 File -> Settings -> Tools -> External Tools 新增一個新的設定
先叫 PyUIC 吧

我都加好了

設定如下
Program : /usr/bin/pyuic5
Arguments : $FileName$ -o $FileNameWithoutExtension$.py
Working Directory : $ProjectFileDir$/$FileDirRelativeToProjectRoot$

接下來再新增一個,就叫 QT Designer

Program : /usr/lib/x86_64-linux-gnu/qt5/bin/designer
Arguments : $FileName$
Working Directory : $ProjectFileDir$/$FileDirRelativeToProjectRoot$

這樣就可以在目錄下的 .ui 檔案上選 PyUIC 將 .ui 轉成 .py
然後選 QT Designer 修改 .ui 檔

你看這樣很簡單吧

Related posts

  1. Ubuntu Python PyQT5安裝 + 連動 PyCharm - Chang's viewpoints - pingback on 2023/03/10 at 10:52 下午

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackbacks and Pingbacks: