tkFileDialogs

brandon harris brandon.harris at reelfx.com
Fri Jul 6 09:22:19 EDT 2012


It doesn't matter whether I pass the actual path in or the global variable name.  The result is the same. 

Brandon L. Harris

________________________________________
From: Karim [kliateni at gmail.com]
Sent: Friday, July 06, 2012 12:42 AM
To: brandon harris
Subject: Re: tkFileDialogs

Le 06/07/2012 07:22, brandon harris a écrit :
> I'm wanting to allow users to select hidden directories in windows and it seems that using the tkFileDialog.askdirectory() won't allow for that.  It's using the tkFileDialog.Directory class which calls an internal command 'tk_chooseDirectory' .  However the file selector dialogs (askopenfilename, asksaveasfilename, etc) has the common windows dialog which supports showing hidden folders.  It's using the tkFileDialog.Open class which is calling an internal command of 'tk_getOpenFile'.
>
> Can anyone shed light on why these two dialogs are so very different and possibly give me a solution to this hidden directory issue.  I have found that you can't really use the Open class because it's going to require a file be selected, not a directory and the Directory class won't navigate to or have an initialdir that is hidden (on windows the %APPDAT% folder is hidden by default)
>
> Windows Example Code.
>
> import tkFileDialog
> # Won't start in or allow navigation to APPDATA
> test = tkFileDialog.askdirectory(initialdir='%APPDATA%')
> # Will start in and navigate to APPDATA
> test = tkFileDialog.askopenfile(initialdir='%APPDATA%')
>
> Thanks in advance for any help given!
>
>
> Brandon L. Harris
Heuuuuuu.

Don't you use os.environ['APPDATA'] if this is an environment variable?

Cheers
karim



More information about the Python-list mailing list