一、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;
四 配置 pyuic5
pyuic5 是将 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, 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
风云阁资源网 Design By www.bgabc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
风云阁资源网 Design By www.bgabc.com
暂无评论...
更新日志
2024年09月20日
2024年09月20日
- 曾轶可.2011-一只猫的旅行【天娱传媒】【WAV+CUE】
- 黑神话悟空上品狼刺客精魄获取方法一览|上品狼刺客精魄收集攻略
- 视觉小说《神椿市建设中REGENERATE》将于2025年2月20日发售
- 黑神话悟空上品鼠弩手精魄获取方法一览|上品鼠弩手精魄收集攻略
- 中国音乐地图听见世界非物质文化遗产《非遗HQCD》wav
- 中国民乐合奏作品集《华夏之音HQ》头版限量编号[WAV+CUE]
- [电影原声带]黎允文《天将雄师》[FLAC+CUE]
- 曝NS继任机型已进入量产阶段:已花了30亿日元
- 不是Switch2?曝《马里奥惊奇》NS捆绑包即将公开
- 暖心任天堂!网友Switch维修返还时贴纸被完好保留
- 《国语老歌 经典对唱情歌 2CD》[WAV/分轨][1.1GB]
- 《刀郎 翻唱精选华语专辑 披着羊皮的狼 》[WAV+CUE][430MB]
- 《真的田震 中国乐坛红极一时的歌者 精品集》[WAV+CUE][300MB]
- 群星.1995-新滚石九大天王之情歌大全【滚石】【WAV+CUE】
- 群星.1993-滚石九大天王十二出好戏·纵夏欢唱【滚石】【WAV+CUE】