From anonymous, 2 Years ago, written in Python.
This paste is a reply to Untitled from anonymous
- view diff
Embed
  1. from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
  2.  
  3. class Signaller(QObject):
  4.  
  5.     signal = pyqtSignal(str)
  6.  
  7.     @pyqtSlot(str)
  8.     def slot(self, arg1, arg2='bar'):
  9.         print(arg1, arg2)
  10.  
  11. sig = Signaller()
  12. sig.signal.connect(sig.slot)
  13. sig.signal.emit('foo')  # prints foo bar
  14.