empty window when using askopenfile

Lonnie Princehouse fnord at u.washington.edu
Fri Apr 16 17:46:00 EDT 2004


s_gherman at yahoo.com (Sorin Gherman) wrote in message news:<ac259413.0404161054.3bcaeaa8 at posting.google.com>...

> Is there any way to minimize/hide the annoying default, empty Tk
> window that shows behind the native file opening dialog , when using
> askopenfile, etc, in tkCommonDialog?


Ah, the pesky Tk root window.  You can minimize it, but I don't think
you can make it disappear completely (without nuking the rest of Tk).

Try this-

import Tkinter, tkFileDialog

tkroot = Tkinter.Tk()
tkroot.iconify()

tkFileDialog.askopenfile()

# If you're not doing anything with Tk besides prompting for the file,
# you'll want to get ride of the root window after askopenfile-
tkroot.destroy()


Alternately, you could just put a pretty picture in the root window
and call it a feature =)



More information about the Python-list mailing list