opening 'file open' dialog from console

Phlip phlip_cpp at
Tue Sep 3 06:38:24 CEST 2002

dsavitsk wrote:

> I would like to open a file open dialog from a console on windows (2000).
> I do this now using the line
>>>> from tkFileDialog import *
>>>> fileName = askopenfilename(filetypes=[(".txt", ".txt")], title="Select
> the file")
> but this opens a second window and leaves it there.  what is the best way
> (tkinter or MFC) to do this w/o the second window?

Fetch the root singleton (or whatever it is) out of Tk land:

        root = Tk()

Withdraw it:


Warning: Sometimes this withdraws the wrong thing. >sigh<

Alternately, pass it into 'askopenfilename', if possible.


  --  Have a :-) day  --

More information about the Python-list mailing list