I have been trying to add an askquestion dialog box to a delete button in Tkinter. Curently I have a button that deletes the contents of a folder once it is pressed I would like to add a yes/no confirmation question.
import Tkinter
import tkMessageBox
top = Tkinter.Tk()
def deleteme():
tkMessageBox.askquestion("Delete", "Are You Sure?", icon='warning')
if 'yes':
print "Deleted"
else:
print "I'm Not Deleted Yet"
B1 = Tkinter.Button(top, text = "Delete", command = deleteme)
B1.pack()
top.mainloop()
Everytime I run this I get the "Deleted" statement even if I press "No". Can an if statement be added to a tkMessageBox?