怎样搭建Qt for Python开发环境

2024-10-13 17:35:44

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

怎样搭建Qt for Python开发环境怎样搭建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开发环境怎样搭建Qt for Python开发环境
猜你喜欢