pyPySide:基于PySide示例的groupbox示例,发出错误本地Qt信号不可调用



基于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()

希望这对你有所帮助。

相关内容

最新更新