I am trying to clear the text box i typed already with a Button 'Clear'.But its not clearing the text once the button is clicked!
Please fix my problem!Answer will be appreciated!
import tkinter as tki
class App(object):
def __init__(self,root):
self.root = root
txt_frm = tki.Frame(self.root, width=600, height=400)
txt_frm.pack(fill="both", expand=True)
# ensure a consistent GUI size
txt_frm.grid_propagate(False)
self.txt1 = tki.Text(txt_frm, borderwidth=3, relief="sunken", height=4,width=55)
self.txt1.config(font=("consolas", 12), undo=True, wrap='word')
self.txt1.grid(row=0, column=1, sticky="nsew", padx=2, pady=2)
button1 = tki.Button(txt_frm,text="Clear", command = self.clearBox)
button1.grid(column=2,row=0)
def clearBox(self):
self.txt1.delete(0, END)
root = tki.Tk()
app = App(root)
root.mainloop()