Tkinter: buttons are dead of tkFileDialog.askopenfilename

John Powers jpowers at acm.org
Mon Jul 10 11:52:24 EDT 2000


I have a simple Python script to illustrate a problem I'm having with
askopenfilename. The following program displays a window with a "Quit"
button. The "Quit" button works until you uncomment the statement which
calls askopenfilename. After selecting a file from the Open Dialog box,
the button window appears but the "Quit" button is dead -- absolutely no
response to pressing it. What's up? Maybe I shouldn't be calling
askopenfilename while initializing App?

from Tkinter import *
import tkFileDialog

class App(Tk):

  def __init__(self):
    Tk.__init__(self)
    filename = "filename"
    #filename = tkFileDialog.askopenfilename()
    Label(self, text=filename).pack()
    Button(self, text="Quit", command=self.quit).pack()

App().mainloop()


tia, jpp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000710/747ca5c5/attachment.html>


More information about the Python-list mailing list