tk_chooseDirectory(n)
π tk_chooseDirectory(n) π
okay bestie, this page is from the Tk Built-In Commands manual, and it's all about popping up a dialog box to let the user pick a directory. iconic behavior, honestly π
πΈ NAME πΈ
tk_chooseDirectory β pops up a dialog box for the user to select a directory. directory-picker main character energy, no cap π
β¨ SYNOPSIS β¨
tk_chooseDirectory ?option value ...?
π¦ DESCRIPTION π¦
okay so the procedure tk_chooseDirectory pops up a dialog box for the user to select a directory. these optionβvalue pairs are possible as command line arguments β option first, value second, that's the vibe π
-commandstring β Specifies the prefix of a Tcl command to invoke when the user closes the dialog after having selected an item. This callback is not called if the user cancelled the dialog. The actual command consists ofstringfollowed by a space and the value selected by the user in the dialog. This is only available on macOS. π-initialdirdirname β Specifies that the directories indirectoryshould be displayed when the dialog pops up. If this parameter is not specified, the initial directory defaults to the current working directory on non-Windows systems and on Windows systems prior to Vista. On Vista and later systems, the initial directory defaults to the last user-selected directory for the application. If the parameter specifies a relative path, the return value will convert the relative path to an absolute path. ποΈ-messagestring β Specifies a message to include in the client area of the dialog. This is only available on macOS. π-mustexistboolean β Specifies whether the user may specify non-existent directories. If this parameter is true, then the user may only select directories that already exist. The default value isfalse. π¨-parentwindow β Makeswindowthe logical parent of the dialog. The dialog is displayed on top of its parent window. On macOS, this turns the file dialog into a sheet attached to the parent window. πͺ-titletitleString β Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed. π
π₯ EXAMPLE π₯
here's the example, copied exactly because commands are sacred bestie β¨
set dir [tk_chooseDirectory \
-initialdir ~ -title "Choose a directory"]
if {$dir eq ""} {
label .l -text "No directory selected"
} else {
label .l -text "Selected $dir"
}
π«Ά SEE ALSO π«Ά
π KEYWORDS π
directoryselectiondialogplatform-specific
okay that's the whole page bestie!! this one comes from Tk Built-In Commands, the footer source/version is Tk 8.3 and it closes with tk_chooseDirectory(n) β the date isn't separately listed on this page, so don't come for me ππ
π¦ where this page comes from
- alpine 3.22: tk-doc 8.6.16-r0 Β· TCL
- alpine 3.23: tk-doc 8.6.17-r0 Β· TCL
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk-doc 8.6.17-r1 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- arch rolling: tk 8.6.16-1 Β· TCL
- fedora 43: tk 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 1998-2000 Scriptics Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms