简体   繁体   中英

How to ask user to input FOLDER PATH in Tkinter Python 2.7

I would like to know how to allow user to key in a folder path, so that when user key in the folder path, it will load all the text file in the folder. However, I would like to do this is Tkinter.

I understand that by using Python IDLE, the code is raw_input . I did some search about using it on tkinter, it stated that use something like ask_directory .

I tried to google ask_directory , however, I couldn't find any source of help on this.

Could anyone help me out regarding this?

On how to ask user to key in path folder and loop through every files in the folder.

To do this

from Tkinter.filedialog import askdirectory

Then to get it go path=askdirectory() The variable path now has the directory in it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM