-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_box.py
141 lines (97 loc) · 2.32 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
from tkinter import *
from tkinter import messagebox
#functions
def info():
messagebox.showinfo(title='Info',
message = 'Passed'
)
def warning():
messagebox.showwarning(title='WARNING',
message = 'Scam Alert!'
)
def error():
messagebox.showerror(title='ERROR',
message='something went wrong')
def ask_ok_cancel():
#messagebox.askokcancel(title='RESPONSE', message='Agree or Not')
#using a conditional statement
if messagebox.askokcancel(title='RESPONSE', message='Agree or Not?'):
print('Agreed : )')
else:
print('Disagreed :( ')
def askretrycancel():
if messagebox.askretrycancel(title='TRY AGAIN', message='Do you want to try again?'):
print('You Retried')
else:
print('You canceled')
def askyesno():
if messagebox.askyesno(title='Ask', message='I am a boy'):
print('Yes')
else:
print('No')
def askquestion():
answer = messagebox.askquestion(title= 'Question', message='Do You Know Me?')
if (answer == 'yes'):
print('He knows me')
else:
print("He doesn't know me")
def askyesnocancel():
answer = messagebox.askyesnocancel(title='yes no cancel', message= 'do you like to code?')
if (answer == True):
print('You like to code')
elif (answer == False):
print('You do not like to code')
else:
print('You are not sure')
window = Tk()
window.config(padx= 50)
window.config(pady= 50)
button = Button(window,
text = 'info',
font = ('Arial', 15),
command = info,
)
button.pack()
button = Button(window,
text = 'warning',
font = ('Arial', 15),
command = warning,
)
button.pack()
button = Button(window,
text = 'Error',
font = ('Arial', 15),
command = error,
)
button.pack()
button = Button(window,
text = 'Response',
font = ('Arial', 15),
command = ask_ok_cancel,
)
button.pack()
button = Button(window,
text = 'Retry',
font = ('Arial', 15),
command = askretrycancel,
)
button.pack()
button = Button(window,
text = 'Reply',
font = ('Arial', 15),
command = askyesno,
)
button.pack()
button = Button(window,
text = 'Quest',
font = ('Arial', 15),
command = askquestion,
)
button.pack()
button = Button(window,
text = 'YesNoCancel',
font = ('Arial', 15),
command = askyesnocancel,
)
button.pack()
window.mainloop()