[英]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()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.