tkinter中'askquestion'和'askyesno'有什么区别?

时间:2015-11-06 02:49:32

标签: python tkinter tkmessagebox

Tkinter中messagebox的askquestion()askyesno()功能有什么区别?

我在这个网站上找到了这两个功能:http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/tkMessageBox.html

1 个答案:

答案 0 :(得分:3)

来自the source

def askquestion(title=None, message=None, **options):
    "Ask a question"
    return _show(title, message, QUESTION, YESNO, **options)

def askyesno(title=None, message=None, **options):
    "Ask a question; return true if the answer is yes"
    s = _show(title, message, QUESTION, YESNO, **options)
    return s == YES

因此,不同之处在于askquestion将返回YESNO,同时askyesno将返回布尔值。