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.

tao4yu
  • 316
  • 1
  • 5
  • 16

1 Answers1

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.

qurban
  • 3,885
  • 24
  • 36
  • 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() – goetz Dec 28 '15 at 01:26