Displaying the file selection dialog
The tk_getOpenFile
and tk_getSaveFile
commands both display a dialog window that allows the end user to select a file to either be opened or saved. The tk_getOpenFile
is used for selecting an existing file only. The tk_getSaveFile
is similar to the Windows Save As dialog box and allows a user to specify a name or select an existing file. If an existing file is selected, the end user is automatically prompted to confirm if the existing file may be overwritten. If the Cancel button is selected, an empty string is returned.
The syntaxes are as follows:
tk_getOpenFile option value … tk_getSaveFile option value …
Both commands accept one or more option value
pair(s), as detailed in the following table. If no option value pairs are provided, the command will display the default values for the dialog.
Option |
Interpretation |
---|---|
|
This is used to specify a string to be appended to the filename if the filename provided has no extension... |