from tkinter import *
app=Tk()
app.title(" BRAIN SYNCRONIZATION SOFTWARE ")
e1=Entry(app).pack()
t1=Text(app).pack()
def InputFun():
file=open("acad.txt","a")
file.write("%s;%s"%(t1.get("0.1",END),e1.get()))
file.close()
b1=Button(app,text="INPUT",command=InputFun,height=3,width=4).pack(side=LEFT,padx=30,pady=30)
這是我寫的代碼,但我反覆得到以下錯誤,當我按下輸入按鈕:爲什麼我得到AttributeError:''NoneType'對象沒有Python和Tkinkter的'get''屬性?
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python31\lib\tkinter\__init__.py", line 1399, in __call__
return self.func(*args)
File "C:\Users\vonn\Desktop\brain syncronization.py", line 15, in InputFun
file.write("%s"%t1.get("0.1",END))
AttributeError: 'NoneType' object has no attribute 'get'
爲什麼不寫文件?
Python位?哎喲! – alex 2011-06-12 03:29:53
@alex :)很好......這就是爲什麼我在這裏! – Vonn 2011-06-12 03:31:41