[PyKDE] Confused on connects.
Gordon Tyler
gordon at doxxx.net
Tue Sep 21 18:01:51 BST 2004
Hihn, Jason wrote:
> def 'Canceled' ():
>
> print 'Canceled'
The above should be:
def cancelled():
print 'Cancelled'
> a=QApplication(sys.argv)
>
> w=QWidgetFactory.create('network.ui')
>
> a.connect(a, SIGNAL("lastWindowClosed()"), a, SLOT("quit()"))
>
> Cancel=w.child('buttonCancel')
>
>
> # HOW DO I CONNECT THIS TO THE Canceled() ABOVE?
>
> a.connect(Cancel, SIGNAL("clicked()"), a, SLOT('Canceled()')) # does not work
QApplication does not define a 'Canceled()' slot.
To connect the cancel button's 'clicked()' signal to the cancelled
function above, use the following:
a.connect(Cancel, SIGNAL("clicked()"), cancelled)
I would recommend that you read both the Qt and PyQt docs on slots and
signals.
Ciao,
Gordon
More information about the PyQt
mailing list