PyQt5信号与槽(二)信号与槽函数情况
二、PyQt5信号与槽(二)信号与槽函数
1、内置信号和内置槽函数
- 本例演示内置信号和内置槽函数
# -*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
"""
# @Time:2022/12/11 0011 11:38
# @Author:晚秋拾叶
# @File:qt07_buildInSignalSlot01.py
# @PyCharm之Python
"""
from PyQt5.QtWidgets import *
import sys
class WinForm(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle('内置的信号和内置的槽函数')
self.resize(300, 50)
btn = QPushButton('关闭', self)
btn.clicked.connect(self.close)
# 发送者btn——>信号clicked——>连接connect——>接收者self——>内置槽函数close
if __name__ == '__main__':
app = QApplication(sys.argv)
wind = WinForm()
wind.show()
sys.exit(app.exec_())
- 在上面代码中,单击按键时触发按键内置的信号&#x