[PyKDE] Signal + Slots Problem

Phil Thompson phil at river-bank.demon.co.uk
Wed Mar 5 19:26:01 GMT 2003


On Wednesday 05 March 2003 5:28 pm, Stuart Bronk wrote:
> Hi,
>
> I currently trying to set up signals and slots in my application I
> understand the principals and have read many examples but I am unable to
> get it working on my own could someone possibly help me out :) as this
> is only a basic test I am hoping to pass objects later but that is
> another step :)
>
> I have a Widget and a class called Figure I am attempting to connect the
> method Figure.loadQ with the Widgets loadQ method but I cannot seem to
> get it to work
>
> This is the code I am attempting to use in my widget:
>
> def __init__(self,parent,name=None):
>     	QGLWidget.__init__(self,parent,name)
> 	self.Figure = Figure.Figure() # instantiate Figure
>       self.connect(self.Figure, SIGNAL("loadQ()"), self.loadQ())
>
> In the Figure class my loadQ method is:
>
> def loadQ():
>       QObject.emit("loadQ()")
>
> The interpreter is giving me the following error
> 	  File "GLWidget.py", line 27, in __init__
>     	     self.connect(self.Figure, SIGNAL("loadQ()"), self.loadQ())
> 	  TypeError: Argument 1 of QObject.connect() has an invalid type
>
> Any help would be much appreciated :)

SIGNAL() is for Qt signals but you are defining a new Python signal.

Try PYSIGNAL() instead.

Phil




More information about the PyQt mailing list