PyQt5开发小软件

PyQt5

可以理解为Qt是C++写的,PyQt只是python封装了C++的接口。所以一般看Qt的文档即可

pip install PyQt5

Qt Designer

PyQt5开发小软件_第1张图片
PyQt5开发小软件_第2张图片
PyQt5开发小软件_第3张图片
有编辑信号/槽的地方,给按钮增加事件

将.ui的文件转换为.py的文件

pyuic5 -o main_ui.py main.ui

main界面

from PyQt5 import QtWidgets
from main_ui import Ui_Dialog

class mywindow(QtWidgets.QWidget, Ui_SRS):
    def  __init__ (self):
        super(mywindow, self).__init__()
        self.setupUi(self)

if __name__=="__main__":
    import sys
    app=QtWidgets.QApplication(sys.argv)
    ui = mywindow()    
    ui.show()
    sys.exit(app.exec_())

发布exe

pip install pyinstaller
pyinstaller --noconsole main.py

可以加-F,只输出一个exe

你可能感兴趣的:(python)