当前位置: 首页 > news >正文

PyQt5学习系列之新项目创建并使用widget

PyQt5学习系列之新项目创建并使用widget

  • 前言
  • 报错
  • 新建项目程序
  • 完整程序
  • 总结


前言

新建项目,再使用ui转py,无论怎么样都打不开py文件,直接报错。


报错

Connected to pydev debugger (build 233.11799.298)

在这里插入图片描述

新建项目程序

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.def print_hi(name):# Use a breakpoint in the code line below to debug your script.print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.# Press the green button in the gutter to run the script.
if __name__ == '__main__':print_hi('PyCharm')# See PyCharm help at https://www.jetbrains.com/help/pycharm/

完整程序

# This is a sample Python script.
import sys# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.from PyQt5.QtWidgets import QWidget, QApplicationimport ImageView
def print_hi(name):# Use a breakpoint in the code line below to debug your script.print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.# Press the green button in the gutter to run the script.
if __name__ == '__main__':app = QApplication(sys.argv)main=QWidget()_ui = ImageView.Ui_Form()_ui.setupUi(main)main.show()print_hi('PyCharm')sys.exit(app.exec_())# See PyCharm help at https://www.jetbrains.com/help/pycharm/

总结

简单记录。

http://www.lryc.cn/news/375591.html

相关文章:

  • mtk8675 安卓端assert函数的坑
  • 编程入门笔记:从基础到进阶的探索之旅
  • 小规模自建 Elasticsearch 的部署及优化
  • MySQL 示例数据库大全
  • VirtualBox、Centos7下安装docker后pull镜像问题、ftp上传文件问题
  • 链表 题目汇总
  • grafana连接influxdb2.x做数据大盘
  • Java证件识别中的身份证识别接口
  • 迷你小风扇哪个品牌好?迷你小风扇前十名公开揭晓!
  • MikroTik RouterOS 授权签名验证分析
  • C#开发-集合使用和技巧(六)特殊转换方法SelectMany的介绍和用法
  • 高考后的抉择:如何在心仪专业与知名学校之间做出选择?
  • 黄仁勋提到的机器人世界,还需要AI数据来“调教” | CVPR 2024
  • 语言中 函数用地址传参的好处
  • Python进阶二: NumPy基础:数组和矢量计算
  • 2024北京智源大会开幕,智源推出大模型全家桶及全栈开源技术基座新版图,大模型先锋集结共探AGI之路
  • 李光明从程序员到架构师的逆袭之路(三)
  • 基于Spring Boot+VUE毕业生信息招聘平台
  • 设计模式-创建型-04-建造者模式
  • jenkins中配置参数化,并在python脚本接收参数实现参数化执行
  • 【SCAU数据挖掘】数据挖掘期末总复习题库应用题及解析
  • ADB->获取当前正在显示的Fragment和Activity的ADB命令
  • C#——集合List
  • 小程序-生命周期(2) 应用周期/页面周期
  • 什么是模板字符串?
  • 服务器数据恢复—热备盘未完全启用导致raid5阵列崩溃的数据恢复案例
  • 微服务项目雪崩的解决思路
  • 汇编语言程序设计 - 新建一个文件:d:\abc.txt,从键盘输入文件的内容(不超过100个字符)
  • 【Linux】进程间通信2——命名管道
  • 语音翻译软件app排名来啦,这些工具让旅游畅通无阻