[PyQt] Weird pyqtSignal behaviour

Giuseppe Corbelli giuseppe.corbelli at copanitalia.com
Mon Jun 27 16:23:49 BST 2011

Hi all

I have two boxes:
Linux with PyQt-GPL 4.8.3/Qt 4.7.0/Python 2.6.6
Windows 7 with PyQt-Commercial 4.8.4/Qt 4.7.3/ActivePython

Consider the following snippet:
# -*- coding: utf-8 -*-

from PyQt4 import QtCore

class CX(QtCore.QObject):
    asig = QtCore.pyqtSignal()

    def __init__(self):
        print self.asig

k = CX()

On the Linux box I get:
cowo at cowo:~$ python test_signal.py
<bound signal asig of CX object at 0xb747a854>

On the Windows box I get:
c:\Devel\Copan\WaspCore>python test_signal.py
Traceback (most recent call last):
  File "test_signal.py", line 13, in <module>
    k = CX()
  File "test_signal.py", line 11, in __init__
    print self.asig
TypeError: pyqtSignal must be bound to a QObject, not 'CX'

            Giuseppe Corbelli
WASP Software Engineer, Copan Italia S.p.A
Phone: +390303666104  Fax: +390302659932
E-mail: giuseppe.corbelli at copanitalia.com

More information about the PyQt mailing list