create custom signal pyqt code example
Example 1: pyqt5 create own signal
@pyqtSlot()
def say_punched():
''' Give evidence that a bag was punched. '''
print('Bag was punched.')
bag = PunchingBag()
# Connect the bag's punched signal to the say_punched slot
bag.punched.connect(say_punched)
Example 2: pyqt5 create own signal
# Punch the bag 10 times
for i in range(10):
bag.punch()