Pass parameters when the pyqt5 button is clicked (via lambda expression)

The response to the button click event in pyqt5 is usually the following way:

self.btn.clicked.connet(self.click_method)

Now if you want to be able to pass parameters when the button is clicked, you can use lambda expressions:

self.btn.clicked.connet(lambda: self.click_method(arg))


def self.click_method(self, arg):
    pass

 

Guess you like

Origin blog.csdn.net/whuzhang16/article/details/109364565