Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

tkinter asksaveasfile

# importing all files  from tkinter
from tkinter import * 
from tkinter import ttk
  
# import only asksaveasfile from filedialog
# which is used to save file in any extension
from tkinter.filedialog import asksaveasfile
  
root = Tk()
root.geometry('200x150')
  
# function to call when user press
# the save button, a filedialog will
# open and ask to save file
def save():
    files = [('All Files', '*.*'), 
             ('Python Files', '*.py'),
             ('Text Document', '*.txt')]
    file = asksaveasfile(filetypes = files, defaultextension = files)
  
btn = ttk.Button(root, text = 'Save', command = lambda : save())
btn.pack(side = TOP, pady = 20)
  
mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: class chain methods python 
Python :: python combine nested for loops 
Python :: mean bias error 
Python :: Check instance has an attribute in python 
Python :: ascii values in python of 
Python :: save a preprocess text 
Python :: python format decimal list 
Python :: hill cipher 
Python :: pyspark groupby with condition 
Python :: python dictionary map function 
Python :: python get dpi of image 
Python :: video timestamp opencv python 
Python :: python check if string is float 
Python :: pandas include nan in value_counts 
Python :: convert utm to decimal degrees python 
Python :: html element python 
Python :: np random list 
Python :: not intersection list python 
Python :: import excel 
Python :: iterating a list in python 
Python :: format numbers in column to percentage in python 
Python :: async webpage 
Python :: python collections counter methods 
Python :: how to get one record in django 
Python :: model coefficients 
Python :: python datetime to unix timestamp 
Python :: python get pattern from string 
Python :: django admin.py date format 
Python :: block content 
Python :: python referenced before assignment in function 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =