您尚未登录。

楼主 #1 2018-06-29 18:18:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Python + Qt 入坑记录

https://www.python.org/ftp/python/3.7.0/python-3.7.0-amd64.exe

https://download.jetbrains.8686c.com/python/pycharm-professional-2018.1.4.exe


D:\Python\Python37\Scripts\pip3.exe install sip
D:\Python\Python37\Scripts\pip3.exe install PyQt5
D:\Python\Python37\Scripts\pip3.exe install PyQt5-tools





离线

楼主 #2 2018-06-30 08:37:45

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: Python + Qt 入坑记录

QQ20180630083706.png





离线

楼主 #3 2018-06-30 09:27:41

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,245
积分: 9197

Re: Python + Qt 入坑记录

下载并安装python3.7版本:

安装python软件包:

D:\Python\Python37\Scripts\pip3.exe install sip
D:\Python\Python37\Scripts\pip3.exe install PyQt5
D:\Python\Python37\Scripts\pip3.exe install PyQt5-tools

打开 Qt Designer, 随便设计一个窗体:
QQ20180630093754.png

根据 *.ui 生成 *.py 文件:

D:\Python\Python37\python.exe -m PyQt5.uic.pyuic test.ui -o test2.py

test2.py 最末添加:

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
if __name__ == '__main__':
    app = QApplication(sys.argv)
    MainWindow = QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

在命令行运行:

D:\Python\Python37\python.exe F:\pywin\test2.py

完美:
QQ20180630092857.png


源码下载: pywin_src.7z





离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn