简体   繁体   中英

How to continue a message box?

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:))

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM