I also ran into that one and I managed to produce a test case.

The problem is that askyesno calls askquestion and compares the result
with 'yes' which is always false if type(result) is _tkinter.Tcl_Obj.

Using a tkFileDialog is (for me) a reliable way to trigger this condition.

Justus
# from /usr/lib/python2.5/lib-tk/tkMessageBox.py:
# [...]
# YES = "yes"
# [...]
# 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
# [...]

import Tkinter
import tkMessageBox
import tkFileDialog

root = Tkinter.Tk()
tkFileDialog.asksaveasfilename()                            # hit cancel
result = tkMessageBox.askquestion('click yes', 'click yes') # click yes
print result, type(result), result == 'yes'
# outputs: yes <type '_tkinter.Tcl_Obj'> False

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to