Newbie question - file selector dialog box?

Jonathan Giddy jon at dgs.monash.edu.au
Tue Mar 28 01:58:56 EST 2000


>This is a newbie question I'm afraid.
>I'd like to pop open a dialog box which allows me to select/browse
>through my local directory and returns the filename selected.
>I'm assuming that this is quite a common task and part of tkinter?

Have a look in:
<prefix>/lib/python1.5/lib-tk/tkFileDialog.py
where <prefix> is where Python is installed (usually /usr/local)

A simple example:

import Tkinter, tkFileDialog
root = Tkinter.Tk()
open = tkFileDialog.Open(root, filetypes=[('Python files', '*.py'),
					  ('All files', '*')])
print `open.show()`





More information about the Python-list mailing list