c/c++语言开发共享pycharm配置QtDesigner的超详细方法

一、qtdesigner介绍qt designer 是一款gui界面工具,可以实现将ui设计界面转为python代码的工具;二、安装 qtdesigner使用命令pip install pyqt5-t


一、qtdesigner介绍

qt designer 是一款gui界面工具,可以实现将ui设计界面转为python代码的工具;

二、安装 qtdesigner

使用命令

  pip install pyqt5-tools -i https://pypi.douban.com/simple --trusted-host=pypi.douban.com

如果已经安装过 anaconda 可以直接使用 如果命令进行安装

  conda install pyqt5-tools

安装完后找到 安装包的路径,比如我的安装路径如下

  c:softanacondaenvsdata_diglibsite-packagespyqt5_toolsqtbindesigner.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:softanacondaenvsdata_digscripts下就找到了,然后进行配置;

参数:$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内容请搜索<计算机技术网(www.ctvol.com)!!>以前的文章或继续浏览下面的相关文章希望大家以后多多支持<计算机技术网(www.ctvol.com)!!>!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/596094.html

(0)
上一篇 2021年5月8日
下一篇 2021年5月8日

精彩推荐