How can i disable an entry using a checkbutton... i got this but it doens't work (python 2.7.1)...
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from Tkinter import *
root = Tk()
class Principal(tk.Tk):
def __init__(self, *args, **kwargs):
foo = ""
nac = ""
global ck1
nac = IntVar()
ck1 = Checkbutton(root, text='Test',variable=nac, command=self.naccheck)
ck1.pack()
global ent
ent = Entry(root, width = 20, background = 'white', textvariable = foo, state = DISABLED)
ent.pack()
def naccheck(self):
if nac == 1:
ent.configure(state='disabled')
else:
ent.configure(state='normal')
app=Principal()
root.mainloop()