[Tutor] tkFileDialog bug on windows

Fred Lionetti lordvader at gmail.com
Sat Dec 3 01:58:26 CET 2005


Hi everyone,

I may have found a strange bug with tkFileDialog, and I'm wondering if
anyone has a workaround for the problem.  It happens when you have a
button (or any other clickable widget) directly behind the
askopenfilename dialog box and double click on a file.  The button
(behind the open file dialog) gets clicked, when it shouldn't.  It
occurs with the code below (but only under windows).

----------------------------------
from Tkinter import *
import tkFileDialog

def cmd():
    print "button was pressed"

parent = Tk()
Button(parent, text = "hello", command = cmd, width=30, height = 10).pack()
tkFileDialog.askopenfilename(parent=parent, title = "Double click on a
file with the 'hello' button directly behind")

parent.mainloop()
---------------------------------

Any ideas?

Thanks!
Fred


More information about the Tutor mailing list