Tkinter:select directory dialog?

Martin Franklin mfranklin1 at
Wed Sep 18 12:20:02 EDT 2002

On Wednesday 18 Sep 2002 2:53 pm, Park997 wrote:
> Hi,
> I have written an application that reads in several data files located in a
> single directory. Currently the directory is hard coded in a module as a
> string variable. On other computers, the data may be located in other
> directories. Is there a Tkinter dialog for choosing a directory, but not
> picking a file to open or write to? An entry field could be OK, but that
> would involve typing in a path, and probably validity checking, etc. A nice
> graphical "choose a directory"  Dialog would help. Does such a thing exist?
> Thanks,
> Wendell Cropper

from tkCommonDialog import Dialog
class Chooser(Dialog):
    command = "tk_chooseDirectory"
    def _fixresult(self, widget, result):
        if result:
            self.options["initialdir"] = result = result # compatibility
        return result

def askdirectory(**options):
    return apply(Chooser, (), options).show()

### Python Powered Signature
I started writting this email on 
Wed Sep 18 16:18:44 2002

More information about the Python-list mailing list