I am trying to get a button on pythons tkinter module to execute the callback function taking the variable 'name'. The problem is this code loops over to create multiple buttons. I need the variable 'name' to be assigned to the callback function at compile time rather than run time so that when any of the buttons are pressed it doesn't just execute the last instance of the variable 'name'.
The text in the button assigns at compile time, but the callback function does not assign its arguments at compile time. Does anyone know a workaround?
lbl = Button(f4, text=f'Show {name} on Map', command=lambda:callback(name),activeforeground="teal")
lbl.pack()