I want to create some buttons in tkinter with a for loop that run a function with a parameter but when I click on the buttons they all output else. I don't know what went wrong, here is my code:
statements = ['print', 'if', 'else']
def ins(state):
  print(state)
  return
count = 0
for x in statements:
  b = Button(self.funcFrame, text=x, command=lambda:ins(x))
  b.grid(row=0, column=count)
  count += 1
Thank you!
 
     
    