TypeError: <lambda>() takes no arguments (1 given) TypeError: <lambda>() takes no arguments (1 given) tkinter tkinter

TypeError: <lambda>() takes no arguments (1 given)


Scale calls the function passed as command with one argument, so you have to use it (although throw it away immediately).

Change:

command=lambda: scale_changed('LED')

to

command=lambda x: scale_changed('LED')


This is presumably because the command is passed an argument that perhaps you don't want. Try changing the lambda from

command=lambda:scale_changed('LED')

to

command=lambda x:scale_changed('LED')


You should consult Tkinter documentation:

Scale widget

command - A procedure to be called every time the slider is moved. This procedure will be passed one argument, the new scale value. If the slider is moved rapidly, you may not get a callback for every possible position, but you'll certainly get a callback when it settles.


Button widget

command - Function or method to be called when the button is clicked.

Change your lambda to

command=lambda new_scale_val: scale_changed('LED')