I have used tkinter to create an asking question messagebox and there are yes
and no
to choose.
I would like to know how to perform clicking 5 times no
then it will show error.
I tried using while loop but after clicking no
one time it didn't show error messagebox.
Below is my code:
from tkinter import Tk, Button
from tkinter import messagebox
count = 5
def love():
ok = messagebox.showwarning(title='WARNING', message='HAHA')
if (ok == "ok"):
while count:
answer = messagebox.askquestion(title='name', message='Who?')
if(answer == 'yes'):
messagebox.showwarning(title='WARNING', message='HAHAAH')
break
else:
count-=1
messagebox.showwarning(title='WARNING', message='Are you sure')
continue
window = Tk()
window.geometry("200x100")
button = Button(window, command=love, text='Click me')
button.pack()
window.mainloop()