PySide: base on the groupbox example of PySide-Example , issue An error native Qt signal is not callable [duplicate]
Asked Answered
T

1

0

Base on the groupbox example of PySide-Example, I add a clicked slot to the pushButton, such as:

    def createPushButtonGroup(self):
                 ...
        pushButton = QtGui.QPushButton("&Normal Button")
        pushButton.clicked(self.normalClick)
                 ...


    def normalClick(self):
        print self.sender.pushButton.text() 

But it issues an error: TypeError: native Qt signal is not callable.

Thrust answered 2/12, 2013 at 5:25 Comment(0)
P
1

I can solve this problem like this:

...
pushButton.clicked.connect(lambda: self.normalClick(pushButton))
...

def normalClick(self, sender):
    print sender.text()

hope this helps you.

Percaline answered 2/12, 2013 at 17:11 Comment(1)
You can use the sender() method, so no need to call the normalClick method with the extra argument. def normalClick(self): print self.sender().text()Peipeiffer

© 2022 - 2024 — McMap. All rights reserved.