为什么这样配置,要开发带UI的python也只能这样了,安装过程如下:
一 安装工具
打开终端:
pip install PyQt6 PyQt6-tools
二 打开设置并汉化
点击plugin,安装汉化插件,如图所示:

安装之后,配置如下:文件-设置-工具-外部工具,如下

三 增加界面设计师的调用

程序:C:UsersAdministratoranaconda3Scriptsqt6-tools.exe
实参:designer
工具目录:$FileDir$
四 增加PYQT6转化工具

界面中变量:
程序:C:UsersAdministratoranaconda3Scriptspyuic6.exe
实参:$FileName$ -o $FileNameWithoutExtension$.py
工具目录:$FileDir$
五 测试程序
调用界面设计师

建个mianwindow界面,任意就行,保存

选中刚才的UI文件,右键点PIU6,把UI文件转成了PY文件,如下图所示

新建个main.py文件,内容如下:
class MyMainForm(QMainWindow, Ui_MainWindow):
def __init__(self):
super(MyMainForm, self).__init__()
self.setupUi(self)
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
app = QApplication(sys.argv)
myw = MyMainForm()
myw.show()
sys.exit(app.exec())
保存,运行,得到如下效果:

好了,把Pycharm配置好了,可以开心地写程序了
© 版权声明
文章版权归作者所有,未经允许请勿转载。如内容涉嫌侵权,请在本页底部进入<联系我们>进行举报投诉!
THE END


















暂无评论内容