怎样搭建Qt for Python开发环境

 时间:2024-10-13 17:35:44

1、按住win+R键,输入cmd打开命令行工具。在命令行中输入python -V 后回车,查看自己电脑中python版本是否符合安装要求。

怎样搭建Qt for Python开发环境

2、在命令行中输入pip install PySide2 从pip包管理软件进行安装下载。成功安装后,会有如图片所示 "稆糨孝汶;successfully installed PySide2-5.12.0" 出现。

怎样搭建Qt for Python开发环境怎样搭建Qt for Python开发环境

3、在搜索栏输入IDLE,打开python 自带的 IDLE 工具。新建一个脚本文件并保存为helloworld.py.

怎样搭建Qt for Python开发环境

4、在代码输入栏写上如下代码:import sysimport randomfrom PySide2 import QtCore, QtWidgets, QtGuic造婷用痃lass MyWidget(QtWidgets.QWidget): def __init__(self): super().__init__() self.text = QtWidgets.QLabel("Hello World") self.text.setAlignment(QtCore.Qt.AlignCenter) self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.text) self.setLayout(self.layout)if __name__ == "__main__": app = QtWidgets.QApplication([]) widget = MyWidget() widget.resize(400, 300) widget.show() sys.exit(app.exec_())

怎样搭建Qt for Python开发环境

5、点击 Run -> Run Module 对程序进行运行,会出现一个带有Helloword字样的界面。

怎样搭建Qt for Python开发环境怎样搭建Qt for Python开发环境
  • VBA如何统计成绩不合格人数?
  • excel vba如何在指定位置插入指定格式的行
  • Excel VBA 怎么禁用所有应用程序加裁项
  • 怎样使用VBA保存时自动备份文件?
  • EXCEL函数 Choose功能及语法结构
  • 热门搜索
    怎么撤回已发送的邮件 冬天怎么钓鱼 吉林动画学院怎么样 丽江攻略自由行 西溪湿地攻略 每天跳绳多少下能减肥 三国战纪攻略 传染性软疣怎么治疗 手机蓝牙怎么连接电脑 梨型身材怎么减肥