python tkinter filedialog folder
from tkinter import filedialog
# Where it open to. # What the window is called.
folder = filedialog.askdirectory(initialdir=os.path.normpath("C://"), title="Example")
python tkinter filedialog folder
from tkinter import filedialog
# Where it open to. # What the window is called.
folder = filedialog.askdirectory(initialdir=os.path.normpath("C://"), title="Example")
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)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us