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 :: how to use iteration in python 
Python :: how to make a calcukatir in python 
Python :: pandas add prefix to column names 
Python :: df.info() in python 
Python :: python 4 release date 
Python :: How to get the Tkinter Label text 
Python :: python3 delete file 
Python :: odd number in python 
Python :: do while loop python 
Python :: round() function in python 
Python :: python sum of 10 numbers from user input 
Python :: the requested resource was not found on this server. django 
Python :: uninstall python kali linux 
Python :: sphinx themes 
Python :: django connexion session time 
Python :: python dataframe limit rows 
Python :: call methods from within a class 
Python :: how to create a matrix from list in python 
Python :: number pattern program in python using for loop 
Python :: pandas get number unique values in column 
Python :: how to open link in new tab selenium python 
Python :: stackoverflow - import data on colabs 
Python :: networkx - remove small components from a graph 
Python :: python enforcing class variables in subclass 
Python :: how to open a widget using sputil.get 
Shell :: git ignore permission changes 
Shell :: Please install the gcc make perl packages from your distribution. 
Shell :: mac restart audio driver 
Shell :: upgrade pillow version 
Shell :: kill a port process in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =