- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtkinter_messagebox_yesno.py
More file actions
Latest commit
19 lines (14 loc) · 595 Bytes
/
Copy pathtkinter_messagebox_yesno.py
File metadata and controls
19 lines (14 loc) · 595 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
importtkinterastk
fromtkinterimportmessagebox
root=tk.Tk()
canvas1=tk.Canvas(root, width=300, height=300)
canvas1.pack()
defExitApplication():
MsgBox=tk.messagebox.askquestion ('Exit Application','Are you sure you want to exit the application',icon='warning')
ifMsgBox=='yes':
root.destroy()
else:
tk.messagebox.showinfo('Return','You will now return to the application screen')
button1=tk.Button (root, text='Exit Application',command=ExitApplication,bg='brown',fg='white')
canvas1.create_window(150, 150, window=button1)
root.mainloop()