PySide: base on the example of the PySide-Example group block, problem. The native Qt signal with an error cannot be called

The basics of the PySide-Example group group example, I add a click slot in pushButton , for example:

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

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

0
source share
1 answer

I can solve this problem as follows:

 ... pushButton.clicked.connect(lambda: self.normalClick(pushButton)) ... def normalClick(self, sender): print sender.text() 

Hope this helps you.

+1
source

Source: https://habr.com/ru/post/959139/


All Articles