I'm making a text editor in Python with Tkinter, and now I'm doing the New button, but when I press that button it deletes all before i click the button "YES". There's the code:
def new():
pop_up_new = Tk()
lb_new = Label(pop_up_new, text="Are you sure to delete?")
bt_new = Button(pop_up_new, text="Yes", command=text.delete(END, '1.0'))
bt_new_no = Button(pop_up_new, text="No", command=pop_up_new.destroy)
lb_new.grid()
bt_new.grid(row =1 , column = 0, sticky = W)
bt_new_no.grid(row = 1, column = 1, sticky = W)
text = Text(window)
text.pack()
menubar = Menu(window)
filemenu = Menu(menubar, tearoff = 1)
filemenu.add_command(label="Open")
filemenu.add_command(label="Save")
filemenu.add_command(label="New", command=new)
filemenu.add_separator()
filemenu.add_command(label="Exit")
menubar.add_cascade(label="File", menu=filemenu)
window.config(menu=menubar)