askopenfilename() as root window

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Dec 18 21:06:54 EST 2007


On 18 dic, 22:43, Sean DiZazzo <half.ital... at gmail.com> wrote:

> Is there any way to open a Tkinter.askopenfilename() without opening a
> root window alongside the file chooser?
>
> I simply want a script to open a dialog and return the chosen file's
> path to stdout.

Yes, create the root yourself so you can call the withdraw() method:

root = Tk()
root.withdraw()
print askopenfilename()

--
Gabriel Genellina



More information about the Python-list mailing list