-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path75_MessageBox.py
More file actions
42 lines (34 loc) · 1.51 KB
/
75_MessageBox.py
File metadata and controls
42 lines (34 loc) · 1.51 KB
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
from tkinter import *
from tkinter import messagebox # import messagebox library
def click():
#messagebox.showinfo(title='This is an info message box',message='You are a person')
#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 a thing')
#else:
#print('You canceled a thing! :(')
#if messagebox.askretrycancel(title='ask ok cancel',message='Do you want retry the thing?'):
#print('You retried a thing')
#else:
#print('You canceled a 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') # we can set icon warning, info
if(answer==True):
print("You like to code :)")
elif(answer==False):
print("Then why are you watching a video on coding?")
else:
print("You have dodged a question ")
window = Tk()
button = Button(window,command=click,text='click me')
button.pack()
window.mainloop()