# -*- coding: utf-8 -*- import easygui who = easygui.buttonbox("你想请谁吃饭 ?", "luckly question", ['我', '步步', '不请']) #如果不想右上角的关闭按钮能关闭,屏蔽所有的if who is None 部分 while who != '我': easygui.msgbox('why is not me,please once again choice') who = easygui.buttonbox("你想请谁吃饭 ?", "luckly question", ['我', '步步', '不请']) print(who) if who is None: break if who is None: pass else: easygui.msgbox("对嘛,请%s吃饭就好啦,不要挣扎" % who)