How to continue a message box?

240 Views Asked by At

I want to write a code that continues the message box after receiving an answer. for example: If they answer yes they get another message box, and same applies for no.

I'm not sure how to word it correctly i hope it makes sense.

I've tried with this:

import tkinter
import tkinter.messagebox
tkinter.messagebox.askyesno(title = "Reginának" , message = "Mizu?")
answer = (tkinter.messagebox.askyesno = "yes")
if answer != "yes"
tkinter.messagebox.showwarning(title = "Reginának" , message = "Persze")

Although i do know that it's not right i was just trying to do something with my limited knowledge :))

1

There are 1 best solutions below

0
On

Try this.

Code:

from tkinter import *
from tkinter import messagebox

ws = Tk()
ws.title('Python Guides')
ws.geometry('300x200')
ws.config(bg='#5FB691')

res = messagebox.askquestion('Reginának', '"Mizu?')
if res == 'yes':
    messagebox.showinfo('Reginának', 'Persze')
elif res == 'no':
    messagebox.showinfo('Reginának', 'You must be a Pele\'s fan.')
else:
    messagebox.showwarning('error', 'Something went wrong!')
 
ws.mainloop()