I want to pass the arguments to a function when I click the button. What should I add to this line button.connect(button, QtCore.SIGNAL(\'clicked()\'), calluser(name))
Here is another way. --- PARTIAL -- I find this one most simple:
widget = QWidget()
widgetLayout = QVBoxLayout()
for action in list:
button = QPushButton("{action}".format(action=action['name']),self)
button.clicked.connect(partial(self.action_selected,action=action['name']))
widgetLayout.addWidget(button)
widget.setLayout(widgetLayout)
def action_selected(self,action):
print action
found on: http://tech-artists.org/forum/showthread.php?3118-PyQt-Maya-How-to-pass-arguments-to-a-function-when-connecting-it-to-PyQt-button