I have the following piece of code:
def callback(param):
print "in callback"
class Test(QThread):
def __init__(self):
QThread.__init__(self)
#QObject.connect(self, SIGNAL("test_signal(PyQt_PyObject)"), callback)
print "Test constructed"
def fallback(self, dummy=None):
print "in fallback"
def run(self):
while 1:
print "Test running"
self.emit(SIGNAL("test_signal(PyQt_PyObject)"), {'a': 'b'})
time.sleep(1)
t = None
if __name__ == "__main__":
t = Test()
t.start()
QObject.connect(t, SIGNAL("test_signal(PyQt_PyObject)"), callback)
while True:
time.sleep(2)
However, callback(param) is never called, as in, I don't see the "in callback" printed on the console. Can anyone help with this? I've tried different variations of the code (e.g. removing the parameter from test_signal, connecting to self.fallback(), not including any paramters in self.emit (i.e. removing {'a': 'b'})). I must be missing a very simple but fundamental mechanism, but I just can't figure it out.
Thanks in advance!