2010-11-21 4 views
-1

내 창을 가지고 있습니다. 이 AttributeError : 'NoneType'개체에 'tk'속성이 없습니다 ??? 당신이 "NoneType TK ''오브젝트가 속성이 없습니다 '"와 같은 오류가 발생하는 경우Tkinter 오류가 발생했습니다.

from Tkinter import * 

root = Tk() 
root.minsize(428, 285) 
root.maxsize(428, 285) 
root.resizable(width=NO, height=NO) 
root.title("TEST") 
root.wm_iconbitmap('C:\Python27\iconfile.ico') 


# create the canvas, size in pixels 
canvas = Canvas(width = 428, height = 255, bg = 'gray95') 

# pack the canvas into a frame/form 
canvas.pack(expand = YES, fill = BOTH) 
gif1 = PhotoImage(file = 'C:\Python27\image.gif') 

# put gif image on canvas 
# pic's upper left corner (NW) on the canvas is at x=50 y=10 
canvas.create_image(0, 0, image = gif1, anchor = NW) 

def die(event): 
    root.destroy() 

b = Button(root, text="text") 
b.bind("<Button-1>", die) 
b["command"] = die 
b.pack() 

root.mainloop() 
mainloop()  
+1

추적은 ...입니까? –

+0

게이 IM noob – Alex

+0

내가 올린 코드는 당신이 말하는 그런 오류를 제공하지 않습니다. –

답변

0

, 그것은 당신이 foo.tk()처럼 보이는 무언가가 어딘가에 코드에서 의미하며, foo가 정의되어 있지 않습니다. 해당 코드 행을 찾아 foo이 정의되지 않은 이유를 파악하십시오. 어쩌면 당신은 아마 당신이 등

0

시도 쓰기, 잘못된 순서를 요구하고, 그것을 맞춤법이 틀린 :
root = Tkinter.Tk()
때때로, 당신은 TK에()가 어디에서 이해할 수있는 프로그램은 Tkinter에 호출해야합니다.

관련 문제