这篇教程pycharm配置QtDesigner的超详细方法写得很实用,希望能帮到您。 一、QtDesigner介绍Qt Designer 是一款GUI界面工具,可以实现将UI设计界面转为Python代码的工具; 二、安装 QTdesigner使用命令 pip install PyQt5-tools -i http://pypi.douban.com/simple --trusted-host=pypi.douban.com 如果已经安装过 anaconda 可以直接使用 如果命令进行安装 conda install PyQt5-tools 安装完后找到 安装包的路径,比如我的安装路径如下 C:/soft/anaconda/envs/data_dig/Lib/site-packages/pyqt5_tools/Qt/bin/designer.exe 
三、配置QTdesigner打开 pycharm 进入工程 , 点击 file–>settings —.tools— extends Tools 的加号进行配置扩展程序 路径:designer 的安装路径 参数:$FileDir$ 工作目录$ProjectFileDir$ 
配置完打开 pycharm 的扩展工具即可在当前工程打开designer; 
打开后随意点击控件拖入 框中,表示配置成功; 
保存当前文件到当前工程命名为hello.ui; 四 配置 pyuic5pyuic5 是将 desginer 生成的ui文件转为 python文件 同样在扩展工具中添加配置 因为我的环境都是anaconda安装的所以在C:/soft/anaconda/envs/data_dig/Scripts/下就找到了,然后进行配置; 参数:$FileName$ -o $FileNameWithoutExtension$.py 工作目录:$ProjectFileDir$ 
配置完成后就可以将刚刚hello.ui 文件进行点击右键,选择扩展程序 PyUIC 就自动在工程目录下将hello.ui 文件转为了 hello.py # -*- coding: utf-8 -*-# Form implementation generated from reading ui file 'hello.ui'## Created by: PyQt5 UI code generator 5.13.0## WARNING! All changes made in this file will be lost!from PyQt5 import QtCore, QtGui, QtWidgetsclass Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(50, 60, 75, 23)) self.pushButton.setObjectName("pushButton") self.radioButton = QtWidgets.QRadioButton(Form) self.radioButton.setGeometry(QtCore.QRect(70, 170, 89, 16)) self.radioButton.setObjectName("radioButton") self.toolButton = QtWidgets.QToolButton(Form) self.toolButton.setGeometry(QtCore.QRect(230, 140, 37, 18)) self.toolButton.setObjectName("toolButton") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Form")) self.pushButton.setText(_translate("Form", "PushButton")) self.radioButton.setText(_translate("Form", "RadioButton")) self.toolButton.setText(_translate("Form", "...")) 五 配置 pyrcc5pyrcc5.exe 是将 资源文件转为 Python 文件 参数: $FileName$ -o $FileNameWithoutExtension$_rc.py 
到此这篇关于pycharm配置QtDesigner的方法的文章就介绍到这了,更多相关pycharm配置QtDesigner内容请搜索51zixue.net以前的文章或继续浏览下面的相关文章希望大家以后多多支持51zixue.net! Python扫描端口的实现 python中HTMLParser模块知识点总结 |