You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent/wrong result of askyesno function in tkMessageBox #49211
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2010-03-20.02:20:21.782>created_at=<Date2009-01-16.09:38:24.424>labels= ['type-bug', 'expert-tkinter']
title='Inconsistent/wrong result of askyesno function in tkMessageBox'updated_at=<Date2010-03-20.02:20:21.780>user='https://bugs.python.org/eb303'
Click the 'Ask confirm' button and answer 'Yes'; it should print
True, which is the expected answer.
Click the 'Ask file' button, select any file and confirm.
Click the 'Ask confirm' button and answer 'Yes'.
The script prints False, which is obviously wrong.
Problem reproduced on Linux Red Hat Fedora Core 4, Suse Enterprise
Linux 9, Solaris 8 for Sparc and Solaris 10 on Intel. The script works
as expected on Windows 2000, so it seems to be Unix-specific.
Possible cause: the result of the _show function in tkMessageBox is not
always a string, apparently depending on what happened before. Changing
the last line to:
return str(res)
seemed to correct the problem for me.
I guess this will have to be accepted without any tests, unless someone
can come up with a way to test tk_messageBox under Windows and Mac.
kvander11 commented on Jan 11, 2010
kvander11mannequin
Mannequin
More actions
I've also confirmed this one (by chance). I'm on ubuntu linux, and I am seeing the problem in both 2.6 and 3.1, both using Tk 8.5. I don't see the problem on my windows install (Vista, python 2.5, not sure of the Tk version right now). But I did find a hack around this by explicitly creating and destroying a top level window following the askdirectory() dialog. Try this snippet on linux/unix, the call to askyesno() returns False always.
importtkFileDialog,tkMessageBox,TkintertheDirectory=tkFileDialog.askdirectory()
addDirectory=tkMessageBox.askyesno('a dialog','Add a directory?')
printaddDirectory
But the following works fine:
importtkFileDialog,tkMessageBox,Tkintertoplevel=Tkinter.Tk()
theDirectory=tkFileDialog.askdirectory()
toplevel.destroy()
addDirectory=tkMessageBox.askyesno('a dialog','Add a directory?')
printaddDirectory
Activity
eb303 commentedon Jan 16, 2009
Scenario to reproduce the problem:
True, which is the expected answer.
The script prints False, which is obviously wrong.
Problem reproduced on Linux Red Hat Fedora Core 4, Suse Enterprise
Linux 9, Solaris 8 for Sparc and Solaris 10 on Intel. The script works
as expected on Windows 2000, so it seems to be Unix-specific.
Possible cause: the result of the _show function in tkMessageBox is not
always a string, apparently depending on what happened before. Changing
the last line to:
return str(res)
seemed to correct the problem for me.
gpolo commentedon Apr 22, 2009
I've verified it, it is indeed a bug in tkMessageBox.py which is very
likely to be noticed while using tk 8.5 or newer.
gpolo commentedon Jun 21, 2009
I guess this will have to be accepted without any tests, unless someone
can come up with a way to test tk_messageBox under Windows and Mac.
kvander11 commentedon Jan 11, 2010
I've also confirmed this one (by chance). I'm on ubuntu linux, and I am seeing the problem in both 2.6 and 3.1, both using Tk 8.5. I don't see the problem on my windows install (Vista, python 2.5, not sure of the Tk version right now). But I did find a hack around this by explicitly creating and destroying a top level window following the askdirectory() dialog. Try this snippet on linux/unix, the call to askyesno() returns False always.
But the following works fine:
doko42 commentedon Mar 16, 2010
the patch works for me with tcl8.5
doko42 commentedon Mar 16, 2010
fixed for 2.7, 3.1, 3.2, commit pending for 2.6 until after the 2.6.5 release
doko42 commentedon Mar 20, 2010
committed to the 2.6 branch as well