Can anyeone help me to debug this code Error is :-- Nonetype has no attribute get | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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()

11th Aug 2020, 2:50 PM
sayyam sancheti
sayyam sancheti - avatar
1 Antwort
+ 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)
12th Aug 2020, 5:05 AM
Prabhakar Dev
Prabhakar Dev - avatar