Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

tkinter filedialog filename

def open_file():
    file = askopenfile(mode='r', filetypes=[
                       ('Text files', '*.txt'), ('CSV Files', '*.csv')])
    if file is not None:
        print(file.name.split("/")[-1]) # this will print the file name

btn = Button(root, text='Open', command=lambda: open_file())
btn.pack(side=TOP, pady=10)
Source by coderslegacy.com #
 
PREVIOUS NEXT
Tagged: #tkinter #filedialog #filename
ADD COMMENT
Topic
Name
9+6 =