PyCharm+Qt Designer+PyUIC安装配置教程-
Qt Designer用于像VC++的MFC一样拖放、设计控件
PyUIC用于将Qt Designer生成的.ui文件转换成.py文件
Qt Designer和PyUIC都包含在PyQt5中,所以我们只需要安装PyQt5塻块然后再指定Qt Designer和PyUIC即可
需要安装哪些东西呢?
sip
PyQt5
Qt
Python
安装sip
方式一:pip安装
使用支持的Python版本,你可以从PyPi安装SIP 通过运行:
pip3 install SIP
方式二:使用Homebrew
brew install sip
不知道brew 的自行百度哈。
安装PyQt5
方式一:pip安装
使用支持的Python版本,你可以从PyPi安装SIP 通过运行:
pip3 install PyQt5
安装Qt
安装很简单,一路下一步,不用配置什么,默认的配置即可,我们只是用Qt的QtDesigner可执行程序,最后不用启动,直接关闭就行。
方式一:本地安装
http://download.qt.io/official_releases/qt/5.8/5.8.0/qt-opensource-mac-x64-clang-5.8.0.dmg
http://download.qt.io/official_releases/qt/5.8/5.8.0/qt-opensource-linux-x64-5.8.0.run
http://download.qt.io/official_releases/qt/5.8/5.8.0/qt-opensource-windows-x86-msvc2015_64-5.8.0.exe
方式二:使用Homebrew
brew install qt
安装是命令行,不是可视化的点击下一步,我没有用这种方式。
配置QtDesigner
可视化的拖控件写UI,一个字爽!

我这边是已经添加好的


各项参数如下:
Name--QTDesigner
Program--/Applications/Qt Designer.app
Working
directory--$ProjectFileDir$
配置PyUIC
用于把QtDesigner创建的UI文件转换成py文件。
我这边是已经添加好的
第一次添加点下面的加号

类似地添加PyUIC
name----PyUIC
Program----/Library/Frameworks/Python.framework/Versions/3.8/bin/pyuic5
Arguments----$FileName$ -o $FileNameWithoutExtension$.py
Working dirctory----$ProjectFileDir$
配置完毕。

如何使用:






在最后添加
if __name__ =='__main__':
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_Dialog()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())