Thursday, August 13, 2020

Create a folder selection dialog in python

 folderdialog without frame:

from tkinter import Tk
from tkinter.filedialog import askdirectory


def get_path():
    root = Tk()
    root.withdraw()
    path = askdirectory()
    root.destroy()
    return path


print(get_path())


 folderdialog with frame:

from tkinter import filedialog
from tkinter import *


directory =  filedialog.askdirectory()
print (directory)

Ref: 1

No comments:

Post a Comment