views:

27

answers:

3

I'm using "tkFileDialog.askopenfilename" to get a file name variable. I know that I can set the "initialdir" option, but not everyone who uses the program will have the target file on the same drive. For example: the file could be located on the C:, D:, E: etc... I don't see a way to view available drives with the dialog box they have open up. I'd like the user to be able to type something like "/h/cowsandstuff" and have it navigate to that directory instead of locking them in. I am programming in a Linux environment, BTW. The analogous function in Windows that I would like is the "My Computer" option in the drop down menu which would list all available drives...

+1  A: 

Linux doesn't have those drive letters C:, D:, etc. In linux all filesystems of different drives are mounted on separate folders in the same tree structure, so you only have a single tree.

Most distros use /media to mount pendrives etc, but hard drives can be configured to mount on any folder. So there's no such thing as "drive letter" in linux, your question doesn't apply.

nosklo
A: 

If you simply point to "/" it contains all mounted devices...

thenickname
If you point to "7" you're in root. These could be mounted devices (not usual) or folders/directories. The mounted devices are usually in the /mnt or /media path
Carlos Tasada
A: 

As nosklo sais, in Linux you don't have drive letters. Everything are paths.

If the file can be in any path, I would expect that the user will known the path, but I would consider the next options:

  • Default to the user's home path. You can directly use the ´~´and tk will convert it to the Linux home folder or the Windows User/My Documents path
  • Remember the last path so you can use it in the future.
Carlos Tasada