I want to set colors of an object, and don't want to create 10 functions for every color. So, I just want to declare the colors and create 10 buttons and one function. Error message is:
<lambda>() missing 1 required positional argument: 'green'
The code:
from tkinter import *
green=["#5bd575","#55c76d"]
#different colors should follow here
root=Tk()
Btn=Button(text="Trigger lambda", command=lambda green: printfunction(green))
Btn.pack()
def printfunction(colorset):
print(colorset)
It does not need to be a lambda function, the question is just, How can I call the printfunction
with an argument by clicking the button?