-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessagebox.py
47 lines (36 loc) · 1.63 KB
/
messagebox.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
from tkinter import *
from tkinter import messagebox # imports messagebox library
def click():
# messagebox.showinfo(title='This is an info message box', message='You are a person')
# while True:
# messagebox.showwarning(title='WARNING', message='You have a VIRUS!!!')
# messagebox.showerror(title='ERROR', message='Something went wrong :(')
# if messagebox.askokcancel(title='Ask ok cancel', message='Do you want to do the thing'):
# print('You did the thing!')
# else:
# print('You canceled the thing! :(')
# if messagebox.askretrycancel(title='Ask ok cancel', message='Do you want to retry the thing'):
# print('You retried the thing!')
# else:
# print('You canceled the thing! :(')
# if messagebox.askyesno(title='Ask yes or no', message='Do you like cake?'):
# print('I like cake too :)')
# else:
# print('Why do you not like cake? :(')
# answer = (messagebox.askquestion(title='ask question', message='Do you like pie?'))
# if answer == 'yes':
# print('I like pie too :)')
# else:
# print('Why do you not like pie? :(')
answer = messagebox.askyesnocancel(title='Yes No Cancel', message='Do you like to code?',
icon='error') # icon='warning','info'
if answer: # if answer == True
print("You like to Code :)")
elif answer == False: # elif Not answer
print("Then why are you watching a video on coding!")
else:
print("You have dodged the question ")
window = Tk()
button = Button(window, command=click, text='Click Me!')
button.pack()
window.mainloop()