On Monday, October 4, 2010 4:41pm, "Dan Halbert" <[email protected]> said:
>I tried to use new-style signals on the Ubuntu 0.4.1 pyside build:
>from PySide.QtCore import *

>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
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to