Displaying the directory dialog
The tk_chooseDirectory
command displays a dialog window that allows the end user to select a directory, as the name implies. The return value is the absolute directory path selected or an empty string (if the Cancel button is clicked).
The syntax is as follows:
tk_chooseDirectory option value …
The tk_chooseDirectory
command accepts one or more option value
pairs as detailed below. If no option value pairs are provided, the command will display the default values for the dialog.
Option |
Interpretation |
---|---|
|
Sets the initial directory to display. If not set, the current working directory will be displayed. |
|
Specifies if the user may specify a non-existing directory. |
|
Specifies the parent of the dialog. The dialog is displayed on top of the parent. |
|
Sets the text to be displayed in the dialog title bar. |
How to do it…
In the following example, we will display a message box and assign...