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))
In Python, class instances are callable. You can just use an instance of a class as a function. That class can contain whatever you want. (In some languages or frameworks, a callable object is called a functor or a function object.)
class CallUser:
def __init__(self, name):
self.name = name
def __call__(self):
print(self.name)
def Qbutton():
button = QtGui.QPushButton("button",widget)
name = "user"
button.setGeometry(100,100, 60, 35)
button.clicked.connect(CallUser(name))
# Object of type CallUser will work as a function!