vjdhama
vjdhama

Reputation: 5058

Pyside Signal and Slots connect New Method

This code:

self.buttonOk.clicked(self.accept())
self.buttonCancel.clicked(self.reject())

Shows this error:

TypeError: native Qt signal is not callable

How do I connect buttonOk's clicked() signal to accept() Slot?

Upvotes: 4

Views: 4386

Answers (1)

ekhumoro
ekhumoro

Reputation: 120598

There are a couple of things wrong with your code.

Firstly, you need to use the signal's connect() method to make the connection; and secondly, you need to pass in a callable object (i.e. no parens).

So your code needs to look like this:

self.buttonOk.clicked.connect(self.accept)
self.buttonCancel.clicked.connect(self.reject)

An overview of PySide's signal and slot support can be found here.

Upvotes: 9

Related Questions