[PyKDE] Python functions as slots
Soeren Fietzke
soeren.fietzke at mscsoftware.com
Mon Sep 30 21:14:00 BST 2002
Hi Konrad,
just leave out the receiver object:
app.connect(button, SIGNAL("clicked()"), foo)
> I have lots of problems using Python functions as slots. As a simple
> illustration, take the following code (an example from Boudewijn Rempt's
> excellent book with an added connect):
>
> import sys
> from qt import *
>
> def foo(*args):
> print args
>
> app=QApplication(sys.argv)
> button=QPushButton("Hello World", None)
> app.setMainWidget(button)
> button.show()
> app.connect(button, SIGNAL("clicked()"), app, foo)
> app.exec_loop()
More information about the PyQt
mailing list