-
Notifications
You must be signed in to change notification settings - Fork 1
/
Message_Box.py
46 lines (38 loc) · 1.34 KB
/
Message_Box.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from tkinter import *
import tkinter.messagebox as tmsg
root = Tk()
def info():
tmsg.showinfo("Info", "This is info message")
def ask_question():
value = tmsg.askquestion("Rate This App", "Do you Like this app?")
if value == "yes":
value = "Rate us on App Store"
else:
value = "We will contact you soon!"
tmsg.showinfo("Your Rating", value)
def retry():
value = tmsg.askretrycancel("Fail", "Application Fail")
if value == True:
value = "Retrying"
else:
value = "Close Application"
tmsg.showinfo("Status", value)
def warning():
tmsg.showwarning("Stop Working", "Application is stopped!")
def quit():
value = tmsg.askyesno("Exit","Do You Want to exit this app?")
if value == True:
value = "Save all the programs"
else:
value = "Application is working"
tmsg.showinfo("Status", value)
main_menu = Menu(root)
sub_menu = Menu(main_menu, tearoff=0)
sub_menu.add_command(label="Info", command=info)
sub_menu.add_command(label="Ask Question", command=ask_question)
sub_menu.add_command(label="Retry", command=retry)
sub_menu.add_command(label="Warning", command=warning)
sub_menu.add_command(label="Yes No", command=quit)
root.config(menu=main_menu)
main_menu.add_cascade(label="Message Box", menu=sub_menu)
root.mainloop()