Tkinter Checkboxes Created In Loop
I'm working on my first Tkinter project, and have used several stackoverflow answers and explanations (and other links they lead to) as the basis for trying to understand how to bu
Solution 1:
Your problem is that self.run_file
is being overwritten at each iteration in the for
loop. To make sure that the IntVar
of each checkbox are not overwritten, store them separately, for example in a list:
self.run_file_IntVars = []
for i, f in enumerate(self.f_list):
self.run_file_IntVars.append(tk.IntVar(value=1))
cb = tk.Checkbutton(self, text=f['file'],
variable=self.run_file_IntVars[i])
cb.pack()
Post a Comment for "Tkinter Checkboxes Created In Loop"