There are many small things in the code. First, Principleinherits from tk.Tk, but you do not import Tkinter under the name tk.
-, . .
-, "nac" - IntVar, get .
, foo textvariable, . Tk (: StringVar)
:
import Tkinter as tk
root = tk.Tk()
class Principal(tk.Tk):
def __init__(self, *args, **kwargs):
self.foo = tk.StringVar()
self.nac = tk.IntVar()
ck1 = tk.Checkbutton(root, text='Test',variable=self.nac, command=self.naccheck)
ck1.pack()
self.ent = tk.Entry(root, width = 20, background = 'white',
textvariable = self.foo, state = tk.DISABLED)
self.ent.pack()
def naccheck(self):
if self.nac.get() == 1:
self.ent.configure(state='disabled')
else:
self.ent.configure(state='normal')
app=Principal()
root.mainloop()
, from Tkinter import * import Tkinter as tk . , , . import * , - , .