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 :: python csv delete specific row 
Python :: np array describe 
Python :: create list in range 
Python :: how to manke a query in google api freebusy python 
Python :: how to print not equal to in python 
Python :: how to add card using py-trello API 
Python :: Python program to check leap year or not? 
Python :: how to open a website with selenium python 
Python :: random variables python 
Python :: python round up 
Python :: how to visualize decision tree in python 
Python :: os walk example 
Python :: intersection of dataframes based on column 
Python :: python write csv line by line 
Python :: not importing local folder python 
Python :: print list vertically in python with loop 
Python :: combinations python 
Python :: python class get attribute by name 
Python :: networkx create graph from dataframe 
Python :: django import settings variables 
Python :: python get time difference in milliseconds 
Python :: python discord how to get user variables 
Python :: download youtube audio python 
Python :: Pandas groupby max multiple columns in pandas 
Python :: create pdf from images python 
Python :: coronavirus tips 
Python :: check dictionary is empty or not in python 
Python :: tkinter hover button 
Python :: python subtract one list from another 
Python :: python download file from web 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =