tkinter中的“ askquestion”和“ askyesno”有什么区别?

whi*_*kar 4 python tkinter tkmessagebox

Tkinter中messagebox 的askquestion()askyesno()函数之间有什么区别?

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

wil*_*l93 5

来源

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
Run Code Online (Sandbox Code Playgroud)

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

  • 我不知道。他们都是由Fred Lundh在1997年7月[介绍](https://github.com/python/cpython/commit/e88b69d52b33ad67f459aec3f45c8436b9bb282f)来的,所以您可能应该在此日期之前在邮件列表档案中搜索涉及该人的讨论: ) (2认同)