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))
so it will pass the value to the function:
def calluser(name):
print name
def Qbutton():
button = QtGui.QPushButton("button",widget)
name = "user"
button.setGeometry(100,100, 60, 35)
button.connect(button, QtCore.SIGNAL('clicked()'), calluser(name))
One more thing, buttons will be generated using for
loop; so name
value will vary. So I want to attach each name with the button. I have done same thing in Pytk by using for
loop and calling the argument base function when clicked.
You can simply write
name = "user"
button.clicked.connect(lambda: calluser(name))