How to assign variables in lambda for tkinter buttons How to assign variables in lambda for tkinter buttons tkinter tkinter

How to assign variables in lambda for tkinter buttons


Define a normal function:

def function():    global choise    choise = question[3]ansBtn1 = tk.Button(self.master, text=question[3], command=function)ansBtn1.grid(row=1, column=0)

If you really really want to use lambda, you can use the walrus operator. For more info read this.