[Python-checkins] r52665 - in python/trunk: Lib/lib-tk/tkMessageBox.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Wed Nov 8 08:35:55 CET 2006


Author: martin.v.loewis
Date: Wed Nov  8 08:35:55 2006
New Revision: 52665

Modified:
   python/trunk/Lib/lib-tk/tkMessageBox.py
   python/trunk/Misc/NEWS
Log:
Patch #1351744: Add askyesnocancel helper for tkMessageBox.


Modified: python/trunk/Lib/lib-tk/tkMessageBox.py
==============================================================================
--- python/trunk/Lib/lib-tk/tkMessageBox.py	(original)
+++ python/trunk/Lib/lib-tk/tkMessageBox.py	Wed Nov  8 08:35:55 2006
@@ -102,6 +102,15 @@
     s = _show(title, message, QUESTION, YESNO, **options)
     return s == YES
 
+def askyesnocancel(title=None, message=None, **options):
+    "Ask a question; return true if the answer is yes, None if cancelled."
+    s = _show(title, message, QUESTION, YESNOCANCEL, **options)
+    # s might be a Tcl index object, so convert it to a string
+    s = str(s)
+    if s == CANCEL:
+        return None
+    return s == YES
+
 def askretrycancel(title=None, message=None, **options):
     "Ask if operation should be retried; return true if the answer is yes"
     s = _show(title, message, WARNING, RETRYCANCEL, **options)
@@ -119,4 +128,5 @@
     print "question", askquestion("Spam", "Question?")
     print "proceed", askokcancel("Spam", "Proceed?")
     print "yes/no", askyesno("Spam", "Got it?")
+    print "yes/no/cancel", askyesnocancel("Spam", "Want it?")
     print "try again", askretrycancel("Spam", "Try again?")

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Nov  8 08:35:55 2006
@@ -96,6 +96,8 @@
 Library
 -------
 
+- Patch #1351744: Add askyesnocancel helper for tkMessageBox.
+
 - Patch #1060577: Extract list of RPM files from spec file in
   bdist_rpm
 


More information about the Python-checkins mailing list