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, QApplication

import 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/


总结

简单记录。

相关推荐

  1. PyQt5学习系列ui转py后的使用

    2024-06-15 17:44:02       30 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-15 17:44:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-15 17:44:02       101 阅读
  3. 在Django里面运行非项目文件

    2024-06-15 17:44:02       82 阅读
  4. Python语言-面向对象

    2024-06-15 17:44:02       91 阅读

热门阅读

  1. Redis(基础篇)

    2024-06-15 17:44:02       23 阅读
  2. 无回显XXE攻击:隐秘的数据泄露技术

    2024-06-15 17:44:02       32 阅读
  3. 深度解析:基于C++的CNN图像检索实现

    2024-06-15 17:44:02       34 阅读
  4. CSP 第34次认证第四题 货物调度

    2024-06-15 17:44:02       29 阅读
  5. 关于编程思想

    2024-06-15 17:44:02       34 阅读
  6. 数列求和、统计输入正数个数 题目

    2024-06-15 17:44:02       33 阅读
  7. 查看队列资源限额和使用情况

    2024-06-15 17:44:02       29 阅读
  8. 一些常见的显示接口

    2024-06-15 17:44:02       37 阅读