0

So I am making a system to upload file for an AI project, so it will be both text files and image files. Is there a way to select files by dragging and dropping into a tkinter window, like how you can in GitHub? And is there a way to open a file browser window to select the files?

1 Answers1

1

Yes. You can open a file browser window to select the files.

import tkinter as tk
from tkinter import filedialog

def getLocalFile():
    root=tk.Tk()
    root.withdraw()

    filePath=filedialog.askopenfilename()

    print('File path:',filePath)
    return filePath

if __name__ == '__main__':
    getLocalFile()
Himpq
  • 36
  • 3