一、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

pycharm配置QtDesigner的超详细方法

三、配置QTdesigner

打开 pycharm 进入工程 , 点击 file–>settings —.tools— extends Tools 的加号进行配置扩展程序

路径:designer 的安装路径

参数:$FileDir$

工作目录$ProjectFileDir$

pycharm配置QtDesigner的超详细方法

配置完打开 pycharm 的扩展工具即可在当前工程打开designer;

pycharm配置QtDesigner的超详细方法

打开后随意点击控件拖入 框中,表示配置成功;

pycharm配置QtDesigner的超详细方法

保存当前文件到当前工程命名为hello.ui;

四 配置 pyuic5

pyuic5 是将 desginer 生成的ui文件转为 python文件

同样在扩展工具中添加配置

因为我的环境都是anaconda安装的所以在C:\soft\anaconda\envs\data_dig\Scripts\下就找到了,然后进行配置;

参数:$FileName$ -o $FileNameWithoutExtension$.py

工作目录:$ProjectFileDir$

pycharm配置QtDesigner的超详细方法

配置完成后就可以将刚刚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, QtWidgets


class 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", "..."))

五 配置 pyrcc5

pyrcc5.exe 是将 资源文件转为 Python 文件

参数:

$FileName$ -o $FileNameWithoutExtension$_rc.py

pycharm配置QtDesigner的超详细方法

标签:
pycharm配置QtDesigner,pycharm,QtDesigner

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com

评论“pycharm配置QtDesigner的超详细方法”

暂无“pycharm配置QtDesigner的超详细方法”评论...

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。