Python, on the parameterized function call, a number of problems that need attention (when listening)

1. If the function is called with no parameters monitor (start ())

Button.clicked.connect(start))

def strat():
    ...

2. If the listener called function parameters (start (x, y))

  • Using lambda keyword
# start()参数列表
Button.clicked.connect(lambda:start(x,y))

def strat(x,y):
    ...

Note: If you do not use the lambda keyword, an error will be reported as follows:

TypeError: argument 1 has unexpected type 'NoneType'

Guess you like

Origin www.cnblogs.com/komean/p/11209873.html