I was going through some code and came across this one, where while hovering the mouse over the radiobuttons, the Checkbutton
gets selected, I have tried keeping a reference to variable(shouldn't be needed as is already global), but it fails.
Here is the code:
from tkinter import *
root = Tk()
text_colors = ['1','2','3','4','5','6','7','8']
rads = []
for i in range(4):
for j in range(2):
col = text_colors.pop()
val = IntVar()
root.garbage_saver = val
rads.append(Radiobutton(root,text=col,fg='red',variable=val))
rads[-1].grid(row=i,column=j)
root.mainloop()
This bug is reproducible on my Windows 10, Python 3.9
Aucun commentaire:
Enregistrer un commentaire