@@ -0,0 +1,1449 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Src: https://www.riverbankcomputing.com/static/Docs/PyQt5/signals_slots.html%0A%0Afrom PyQt5.QtCore import QObject, pyqtSignal%0A%0Aclass Foo(QObject):%0A%0A    # Define a new signal that has no arguments.%0A    # New signals should only be defined in sub-classes of QObject.%0A    # They must be part of the class definition and cannot be dynamically added as class attributes after the class has been defined.%0A    sig_1 = pyqtSignal()%0A%0A    # This defines a signal that takes two integer arguments.%0A    sig_2 = pyqtSignal(int, int)%0A%0A    ## The following two lines don't work!%0A    #def __init__(self):%0A    #    self.sig_1 = pyqtSignal()%0A%0A%0A    def slot_1(self):%0A        print(%22Sig_1 signal received%22)%0A%0A    def slot_2(self, n1, n2):%0A        print(%22Sig_2 signal received%22, n1, n2)%0A%0A%0A    def connect_sig_1(self):%0A        # Connect the sig_1 signal to slot_1%0A        self.sig_1.connect(self.slot_1)%0A%0A    def disconnect_sig_1(self):%0A        # Disonnect the sig_1 signal from slot_1%0A        self.sig_1.disconnect(self.slot_1)    # disconnect(%5Bslot%5D)%0A%0A    def emit_sig_1(self):%0A        # Emit the signal.%0A        self.sig_1.emit()%0A%0A%0Afoo = Foo()%0A%0Afoo.connect_sig_1()%0Afoo.emit_sig_1()%0Afoo.disconnect_sig_1()%0Afoo.emit_sig_1()%0A%0Aprint(%22-%22 * 10)%0A%0Afoo.sig_1.connect(foo.slot_1)%0Afoo.sig_1.emit()%0Afoo.sig_1.disconnect(foo.slot_1)%0A%0Aprint(%22-%22 * 10)%0A%0Afoo.sig_2.connect(foo.slot_2)%0Afoo.sig_2.emit(1, 2)%0Afoo.sig_2.disconnect(foo.slot_2)%0A

Add a snippet.