How to select a directory and store the location using tkinter in Python

前端 未结 2 1951
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 04:09

I am creating a GUI with a browse button which I only want to return the path. I\'ve been looking at solutions using code like below.

Tkinter.Button(subfram         


        
相关标签:
2条回答
  • 2020-11-29 04:27

    This code may be helpful for you.

    from tkinter import filedialog
    from tkinter import *
    root = Tk()
    root.withdraw()
    folder_selected = filedialog.askdirectory()
    
    0 讨论(0)
  • 2020-11-29 04:32

    It appears that tkFileDialog.askdirectory should work. documentation

    0 讨论(0)
提交回复
热议问题