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

会有一股神秘感。 提交于 2019-12-25 04:54:25

问题


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.


回答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.



来源:https://stackoverflow.com/questions/20321430/pyside-base-on-the-groupbox-example-of-pyside-example-issue-an-error-native-q

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!