[PyKDE] Re: Error with connecting SIGNAL to PYSIGNAL

Lee Harr missive at hotmail.com
Sat Mar 13 16:28:01 GMT 2004

>what's the matter with this?
>Traceback (most recent call last):
>   File "Track.py", line 684, in ?
>     w = Track()
>   File "Track.py", line 610, in __init__
>     QObject.connect(self.controllerWidget.unloadButton, 
>TypeError: Argument 3 of QObject.connect() has an invalid type

I am still a newb on this list, but maybe I can help...

One thing you may want to do is create a minimalist example
which exhibits the behavior you are seeing. That will help other
people to see the problem (it is pretty tough from the snip you
give) and to point out the correct solution.

After playing with this for a while, it looks like the PYSIGNAL string
can be pretty much anything, but it needs to match exactly from
signal to signal and from signal to slot. See if this helps you ...

import sys
from qt import *

class Form1(QDialog):
    def __init__(self, parent=None, name=None, modal=0, fl=0):
        QDialog.__init__(self, parent, name, modal, fl)

        self.pushButton1 = QPushButton(self, "pushButton1")
        self.pushButton1.setGeometry(QRect(10, 10, 161, 80))


        self.connect(self.pushButton1, SIGNAL('clicked()'), 
        self.connect(self, PYSIGNAL('a_pysig'), self.on_pysig)
        self.connect(self, PYSIGNAL('a_pysig'), self.on_pysig2)

        self.connect(self.pushButton1, SIGNAL('clicked()'), 
        self.connect(self, PYSIGNAL('a_pysig(int)'), self.on_pysig2)

        self.connect(self, PYSIGNAL('a_pysig(zerg)'), 

    def on_pysig(self):
        self.emit(PYSIGNAL('a_pysig(zerg)'), ('After',))

    def on_pysig2(self):
        print 'on_pysig2'

if __name__ == '__main__':
    app = QApplication(sys.argv)

    f1 = Form1()


Tired of spam? Get advanced junk mail protection with MSN 8. 

More information about the PyQt mailing list