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 ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.