未绑定(未实例化)和 绑定(实例化)的(PyQt5)信号

Unbound and Bound Signals

A signal (specifically an unbound signal) is a class attribute. When a signal is referenced as an attribute of an instance of the class then PyQt5 automatically binds the instance to the signal in order to create a bound signal. This is the same mechanism that Python itself uses to create bound methods from class functions.

http://pyqt.sourceforge.net/Docs/PyQt5/signals_slots.html#unbound-and-bound-signals 

 未绑定(未实例化)和 绑定(实例化)的(PyQt5)信号

信号是类的属性

(为什么特制未绑定的信号呢,我从许多教程的例子中看到,凡是定义class时,第一行都是:

trigger = pyqtSignal()

)


class WorkThread(QThread):
    trigger = pyqtSignal()
    def __int__(self):
    ......

https://blog.csdn.net/a359680405/article/details/45220663

https://baijiahao.baidu.com/s?id=1576158660151505472&wfr=spider&for=pc

https://zmister.com/archives/178.html

https://www.jb51.net/article/118793.htm

https://www.cnblogs.com/archisama/p/5444032.html

 当信号被作为类的实例(instance)的属性引用时,(也就是类被实例化以后),PyQt5自动将信号与实例绑定,这就创建了绑定信号(bound signal)。

创建绑定信号的原理与python创建类的绑定方法类似。(所谓绑定方法,我猜就是实例的方法)。

猜你喜欢

转载自blog.csdn.net/qq_27361945/article/details/82789467