基于PySide example的groupbox示例,我在pushButton
中添加了一个点击的插槽,例如:
def createPushButtonGroup(self):
...
pushButton = QtGui.QPushButton("&Normal Button")
pushButton.clicked(self.normalClick)
...
def normalClick(self):
print self.sender.pushButton.text()
但它发出了一个错误:TypeError: native Qt signal is not callable
。
我可以这样解决这个问题:
...
pushButton.clicked.connect(lambda: self.normalClick(pushButton))
...
def normalClick(self, sender):
print sender.text()
希望这对你有所帮助。