def getSaveFile(strdir='C:\\', strfile = 'file.txt', strtitle='Save file as ...'):
"""Pop up a file dialog window to select a file to save."""
options = {}
options['initialdir'] = strdir
options['title'] = strtitle
#options['defaultextension'] = '.txt'
#options['filetypes'] = [('all files', '.*'), ('text files', '.txt')]
options['initialfile'] = strfile
#options['parent'] = root
root = tkinter.Tk()
root.withdraw()
file_path = filedialog.asksaveasfile(**options)
#same as: file_path = tkinter.filedialog.asksaveasfile(**options)
return file_path
评论列表
文章目录