◐ Shell
clean mode source ↗

Message 97610 - Python tracker

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.

import tkFileDialog,tkMessageBox,Tkinter
theDirectory=tkFileDialog.askdirectory()
addDirectory=tkMessageBox.askyesno('a dialog','Add a directory?')
print addDirectory


But the following works fine:

import tkFileDialog,tkMessageBox,Tkinter
toplevel=Tkinter.Tk()
theDirectory=tkFileDialog.askdirectory()
toplevel.destroy()
addDirectory=tkMessageBox.askyesno('a dialog','Add a directory?')
print addDirectory