0
Can anyeone help me to debug this code Error is :-- Nonetype has no attribute get
from tkinter import * import time a=time.strftime('%d-%m-%Y') root = Tk() def save(): got=notebox.get(1.0, END) f= open(a+'.txt','w') f.write('note\n') f.write(got) f.close() name=Label(root, text='my note').grid(row=0, column=0) notebox= Text (root, width=20 , height=10 , wrap=WORD).grid(row=0, column=1) submit=Button(root, text='submit', command=save).grid(row=3, column=1) root.mainloop()
1 Answer
+ 1
the grid function you are using takes the Text object and returns None.
use it like this
notebox= Text (root, width=20 , height=10 , wrap=WORD)
notebox.grid(row=0, column=1)