Help with pysignals with QT

root root at localhost.localdomain
Sat Jan 19 13:47:59 EST 2002


Hello, 

I'm trying to learn to create signals and slots with pyQt. I've nener had a 
problem with them in c++ buty I think I'm missing the point within python. 

Here's a sample piece of code. 
from qt import *
         
class test(QObject):
    def __init__(self):
         QObject.__init__(self,None,None)
        
    def send(self):
         print "about to emit"   
         self.emit(PYSIGNAL("pySig()"),())
         print "emit"
         
class message:
    def hello(self):
        print "The slot called"

class join:
    def __init__(self):
        print "in join"
        self.m = message()
        t = test()
        a.connect(t,PYSIGNAL('pySig()'),self.m.hello)
        print "connected"

a = QApplication(sys.argv)
j= join()
test = test()
test.send()

This prints:
in join,
connected
about to emit
emit

I have been trying various permutations around this for several days 
without success, I dont know if the signal isn't being emitd or if theres 
something wrong with my connect statement.

Thanks for any help you can give
Tony



More information about the Python-list mailing list