PySide:基于 PySide-Example 的 groupbox 示例,问题 An error native Qt signal is not callable [英] PySide: base on the groupbox example of PySide-Example , issue An error native Qt signal is not callable

查看:204
本文介绍了PySide:基于 PySide-Example 的 groupbox 示例,问题 An error native Qt signal is not callable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于 Py示例,我在pushButton中添加了一个clicked slot,如:

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

但它发出一个错误:TypeError: native Qt signal is not callable.

推荐答案

我可以这样解决这个问题:

I can solve this problem like this:

...
pushButton.clicked.connect(lambda: self.normalClick(pushButton))
...

def normalClick(self, sender):
    print sender.text()

希望对你有帮助.

这篇关于PySide:基于 PySide-Example 的 groupbox 示例,问题 An error native Qt signal is not callable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆