Ttk file selection dialog

Manual page

File system dialog boxes

fsdialog - dialog boxes for the user to select a file or directory.


package require Tk 8.6.6
package require fsdialog 2.0

ttk::fsdialog configfile ?name?
ttk::fsdialog history ?name ...?
ttk::fsdialog preferences ?option? ?value option value ...?


The fsdialog package installs direct replacements for the original tk_getOpenFile, tk_getSaveFile, and tk_chooseDirectory commands of Tk. The replacements provide more advanced features for user interaction. See the manual pages of the original commands for the details on their usage.

To control the advanced features, the package provides some additional commands.

ttk::fsdialog configfile ?name?
Specify a configuration file for the dialogs to automatically store and retrieve the preference settings and history. By default, the package will use the file "~/.config/tcltk/fsdialog.cfg", but only if that file exists. Calling this command without the name argument will create the default configuration file, so it is guaranteed to be used. Specify an empty string for name to prevent the use of the default configuration file, even if it exists.
ttk::fsdialog history ?name ...?
Get or seed the list of files and directories that will be presented to the user in various drop-down lists. That list is normally maintained automatically, but this command makes it available for external storage and loading.
ttk::fsdialog preferences ?option? ?value option value ...?
Configure preference settings. This command is provided for situations where the use of a specific configuration file for the file system dialogs is not desired. For example, when the preferences are going to be stored as part of the overall application configuration.

If no name or value arguments are supplied, the command returns a list containing alternating option names and values for the channel. If name is supplied but no value then the command returns the current value of the given option. If one or more pairs of name and value are supplied, the command sets each of the named options to the corresponding value; in this case the return value is an empty string.

The following settings are available:

details boolean
Show the short (0) or long (1) version of the file list. Default: 0.
duopane boolean
Combine files and directories in a single pane (0) or show directories in a separate pane (1). Default: 0.
hidden boolean
Show hidden files and directories. Default: 0.
mixed boolean
List directories before files (0) or list all entries without making a distinction between files and directories (1). This setting only has effect when files and directories are shown in a single pane. Default: 0.
reverse boolean
Show the entries in reverse sorting order. Default: 0.
sort property
Select which property to use for sorting the entries in the file pane. The directory pane is always sorted by name. Possible values are name, date, and size. Default: name.