我尝试在 PyQt 类中添加一个函数,但它总是返回一个错误。
# Error: TypeError: connect() slot argument should be a callable or a signal, not 'NoneType' #
def commander (self, arg):
exec arg
def aButton (self, layout, **kwargs):
name = kwargs.pop("name","Button")
command = kwargs.pop("command", "" )
button = QtGui.QPushButton(name)
button.clicked.connect(self.commander(command))
layout.addWidget(button)
return button
可能有人可以帮我解决这个问题:')谢谢!