4.20今日总结

Pyqt5信号与槽

# -*- coding: utf-8 -*-# Form implementation generated from reading ui file 'signal.ui'#

# Created by: PyQt5 UI code generator 5.11.3#

# WARNING! All changes made in this file will be lost!import sysfrom PyQt5 import QtCore, QtGui, QtWidgetsfrom PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBoxclass Ui_Form(object):def setupUi(self, Form):

Form.setObjectName("Form")

Form.resize(431, 166)

self.pushButton = QtWidgets.QPushButton(Form)

self.pushButton.setGeometry(QtCore.QRect(160, 50, 91, 41))

font = QtGui.QFont()

font.setFamily("YaHei Consolas Hybrid")

font.setPointSize(14)

self.pushButton.setFont(font)

self.pushButton.setObjectName("pushButton")

self.retranslateUi(Form)

QtCore.QMetaObject.connectSlotsByName(Form)def retranslateUi(self, Form):

_translate = QtCore.QCoreApplication.translate

Form.setWindowTitle(_translate("Form", "信号与槽"))

self.pushButton.setText(_translate("Form", "关闭"))class MyMainForm(QMainWindow, Ui_Form):def __init__(self, parent=None):

super(MyMainForm, self).__init__(parent)

self.setupUi(self)

self.pushButton.clicked.connect(self.close)if __name__ == "__main__":

app = QApplication(sys.argv)

myWin = MyMainForm()

myWin.show()

sys.exit(app.exec_())

posted @   不洗澡超酷  阅读(11)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
点击右上角即可分享
微信分享提示