How to pass arguments to functions by the click of button in PyQt?

后端 未结 6 1502
时光说笑
时光说笑 2020-12-07 20:45

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

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 21:41

    You can simply write

    name = "user"
    button.clicked.connect(lambda: calluser(name))
    

提交回复
热议问题