Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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")
Comment

python tkinter filedialog

from tkinter import filedialog

						# Where it open to.					# What the window is called.	# What file types the user can choose between. first one is the defualt. (("what ever", "*.format"), ("what ever 2", "*.format2"))
filedialog.askopenfilename(initialdir=os.path.normpath("C://"), title="Example", filetypes =(("PNG", "*.png"),("JPG", "*.jpg"),("All Files","*.*")))
Comment

tkinter filedialog

from tkinter import filedialog
 
filedialog.asksaveasfilename()
filedialog.asksaveasfile()
filedialog.askopenfilename()
filedialog.askopenfile()
filedialog.askdirectory()
filedialog.askopenfilenames()
filedialog.askopenfiles()
Comment

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)
Comment

PREVIOUS NEXT
Code Example
Python :: average value of list elements in python 
Python :: update jupyter notebook 
Python :: mongodb between two values 
Python :: timedelta year python 
Python :: find all text in site python 
Python :: python change filename 
Python :: python datetime module print 12 hour clock 
Python :: min int python 
Python :: sum of all nan values pandas 
Python :: how to update python in linux 
Python :: dropdown in tkinter 
Python :: np.save function 
Python :: transpose a matrix using list comprehension 
Python :: pd.set_option show all rows 
Python :: name unnamed column pandas 
Python :: django docs case when 
Python :: draw spiral in matplotlib 
Python :: train test split stratify 
Python :: python datetime now minus 3 hours 
Python :: numpy remove rows containing nan 
Python :: dataframe to list 
Python :: how to sum digits of a number in python 
Python :: display full dataframe pandas 
Python :: replace cell pandas 
Python :: tkinter labelframe 
Python :: python open file exception 
Python :: get current week python 
Python :: python two while loops at same time 
Python :: how to create a car game using python 
Python :: python remove text between parentheses 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =