从tkinter导入* window = Tk()
nac = {} ent = {}
对于范围(10)中的i: de = IntVar() nac [i] = IntVar()
na=Checkbutton(window, text='%s' % (i), borderwidth=1,variable =
nac[i], onvalue = 1, offvalue = 0,command=lambda e=ent,
v=nac[i]:naccheck(e,v))
na.grid(row=i, column=0)
ent[i]=Entry(window,textvariable=de, state = DISABLED)
ent[i].grid(column=1,row=i,padx=20)
window.mainloop()
答案 0 :(得分:0)
尝试一下:
from tkinter import *
def entry():
ent[i].configure(state = NORMAL)
window=Tk()
nac = {}
ent = {}
for i in range(10):
de = IntVar()
nac[i]=IntVar()
na=Checkbutton(window, text='%s' % (i), borderwidth=1,variable = nac[i],
onvalue = 1, offvalue = 0,command=entry)
na.grid(row=i, column=0)
ent[i]=Entry(window,textvariable=de, state = DISABLED)
ent[i].grid(column=1,row=i,padx=20)
window.mainloop()