0

I am making a program in Python using TKinter. Part of the code automatically creates a button with certain text on it.

global series
Button(f, bg='blue', width=int(0.012 * x), height=int(0.001 * x), fg='white',font=("Helvetiva", int(54 * (x / 600)), "bold"), text=str(series)+word,command=lambda: pressed(series).pack())
series+=1

The code above is called multiple times to create multiple buttons with different text values. When the function "pressed" is called, I wanted the button that called it to be identifiable by the value of the argument of "pressed", set to be equal to "series". However, as the value of "series" changes, the value of that argument also changes. Is there any way to set that argument to be equal to the value of "series" at that moment, so that it does not change along with series.

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376

0 Answers0