I am creating a GUI application that requires the path to folder that user selects. I am using eel library of python to achieve the GUI with HTML, CSS and JS. I just want the path to the folder, I don't want the files in that folder to be uploaded.
Any Solutions ?
So I found a work around with tkinter and may help others.
in my python I expose a tkinter function to open directories and choose a folder
import tkinter 
import tkinter.filedialog as filedialog
@eel.expose
def selectFolder():
    print("Here")
    root = tkinter.Tk()
    root.attributes("-topmost", True)
    root.withdraw()
    directory_path = filedialog.askdirectory()
    print(directory_path)
in my HTML
<button class="items" onclick="select()">Choose folder</button>
in my JS I am just calling selectFolder() function from python.
function select(){
  eel.selectFolder();
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With