Advertisement

通过QTDesigner构建窗体带有打开文件Button

阅读量:

先展示代码部分
首段代码是通过qtdesigner工具采用拖拽操作来创建UI文件,在此过程中,针对button组件也需建立信号与槽的关联关系,其中pushButton的点击动作将被绑定至openImage()函数,该函数将在后续进行定义。而pushBotton_2的点击动作则会连接至runModel()函数(同样为自定义函数)

将文件保存为.ui格式

在这里插入图片描述

.ui文件借助扩展工具pyuic进行转换,生成对应的.py文件,
如下

复制代码
    # -*- coding: utf-8 -*-
    
    # Form implementation generated from reading ui file 'mainwindow.ui'
    #
    # Created by: PyQt5 UI code generator 5.11.3
    #
    # WARNING! All changes made in this file will be lost!
    
    from PyQt5 import QtCore, QtG

全部评论 (0)

还没有任何评论哟~