import sys

from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton


class RegisterWindow(QWidget):
    # 创建一个带参信号(不能在init中创建)
    signal = pyqtSignal(int)

    def __init__(self):
        super().__init__()
        # 信号绑定到处理函数上
        self.signal.connect(lambda param: print(param))
        self.init_ui()

    # 发送信号函数
    def send_signal(self):
        self.signal.emit(100)

    # 用来触发发送信号函数的按钮
    def init_ui(self):
        button = QPushButton("click", self)
        button.clicked.connect(self.send_signal)

        self.setGeometry(600, 300, 600, 600)  # 设置窗口坐标大小
        self.setWindowTitle('窗口标题')
        self.show()


if __name__ == '__main__':
    q_application = QApplication(sys.argv)
    window = RegisterWindow()
    sys.exit(q_application.exec_())