tkFileDialog.askopenfilename()

Kevin Walzer kw at codebykevin.com
Tue May 15 19:38:12 EDT 2007


rahulnag22 at yahoo.com wrote:
> Hi,
> When I call tkFileDialog.askopenfilename() , the dialog box opens with
> the current directory as the default directory. Is it possible to open
> the dialog box with a directory other than the current directory. Can
> we pass in  a user defined starting directory.
> Thanks
> Rahul
> 

Use the "initialdir" flag:

filename = askopenfilename(title="Open File", 
initialdir=(os.path.expanduser('~/'))

HTH,
Kevin
-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com



More information about the Python-list mailing list