Rex Rex - 3 months ago 12
Python Question

'module' object has no attribute 'TK'

I'm a beginner of learning GUI.
My python version is 2.7
and I'm using windows.
I've search tkinter in folder there is only one python file which is in C:\python27

here is my code. :)

class Electronic_Signature_User_Program(tk.TK):
def __int__(self,*args,**kwargs):
tk.Tk.__int__(self, *args, **kwargs)

container = tk.Frame(self)
container.pack(side = "top",fill = "both",expand = True)
container.grid_rowconfigure(0,weight=1)
container.grid_columconfigure(0,weight=1)

self.frames = {}

for F in (Loginpage, Login_Confirm):
frame = Loginpage(container,self)
self.frames[Loginpage] = frame
frame.grid(row=0,colum=0,sticky="nsew")

self.show_frame(Loginpage)

def show_frame(self,cont):
frame = self.frames[cont]
frame.tkraise()

class Loginpage(tk.Frame):
def __int__(self, parent, controller):
tk.Frame.__int__(self, parent)
button1 = tk.Button(self,text="button1",commad=lambda:controller.show_frame(Login_Confirm))
button1.pack()

class Login_Confirm(tk.Frame):
def __int__(self, parent, controller):
tk.Frame.__int__(self, parent)
button1 = tk.Button(self,text="button1",commad=lambda:controller.show_frame(Loginpage))
button1.pack()


app = Electronic_Signature_User_Program()
app.mainloop()

Answer

In the very first line of code you have TK where it should be Tk.

Comments