>sig = Signal()
>def foo(): print 2
>sig.connect(foo)
>AttributeError: 'Signal' object has no attribute 'connect'
Sorry! Never mind - my example was too simple. The Signal() has to be defined in an class that inherits from QObject, and you have to instantiate such an object:
class C(QObject):
sig = Signal()
def foo():
print 2
c = C()
# Note that: C.sig.connect(foo) does not work.
c.sig.connect(foo)
In my actual program which provoked the original email, I referred to a signal by referencing it through the class, not the instance.
_______________________________________________
PySide mailing list
PyS...@lists.openbossa.org
http://lists.openbossa.org/listinfo/pyside
I wrote this example base on your example, and works very well.
from PySide.QtCore import QObject, Signal
class C(QObject):
sig = Signal()
def foo():
print 2
c = C()
c.sig.connect(foo)
c.sig.emit()
OUTPUT:
# python test.py
2
Which error do you get, when you try connect the signal? Can you send
the python back trace? Which version of pyside are you using?
BR
--
Renato Araujo Oliveira Filho
Instituto Nokia de Tecnologia - INdT
Mobile: +55 (81) 8704-2144
So I am all set - everything works now.
Thanks,
Dan