def filesavebox(msg=None
, title=None
, default=""
, filetypes=None
):
"""
A file to get the name of a file to save.
Returns the name of a file, or None if user chose to cancel.
The "default" argument should contain a filename (i.e. the
current name of the file to be saved). It may also be empty,
or contain a filemask that includes wildcards.
The "filetypes" argument works like the "filetypes" argument to
fileopenbox.
"""
boxRoot = Tk()
boxRoot.withdraw()
initialbase, initialfile, initialdir, filetypes = fileboxSetup(default,filetypes)
f = tk_FileDialog.asksaveasfilename(parent=boxRoot
, title=getFileDialogTitle(msg,title)
, initialfile=initialfile
, initialdir=initialdir
, filetypes=filetypes
)
boxRoot.destroy()
if not f: return None
return os.path.normpath(f)
#-------------------------------------------------------------------
#
# fileboxSetup
#
#-------------------------------------------------------------------
评论列表
文章目录