user3415609
user3415609

Reputation:

How do I use a GUI to open a directory in Python 3?

I want to find the string value of the directory in Python where a few files are located. Then, I plan on using os.listdir to continue on with the script. I've tried using tkFileDialog to use askdirectory, but not luck.

Upvotes: 1

Views: 9563

Answers (1)

atlasologist
atlasologist

Reputation: 3974

tkFileDialog changed with Python 3.x, it's now tkinter.filedialog, a module of tkinter

Here's how to import it:

from tkinter.filedialog import askdirectory

folder = askdirectory()

Refer to: http://docs.python.org/3.0/library/tkinter.html#tkinter-modules

Upvotes: 10

Related Questions