tk_messageBox(n)
π
tk_messageBox π
Okay bestie, welcome to the Tk Built-In Commands manual page for tk_messageBox(n) β the pop-up queen herself π. She's here to pop up a message window and wait for user response, and honestly? Iconic.
β¨ NAME β¨
tk_messageBox β pops up a message window and waits for user response. Periodt. π
π¦ SYNOPSIS π¦
tk_messageBox ?option value ...?
πΈ DESCRIPTION πΈ
So here's the vibe: this procedure creates and displays a message window with an application-specified message, an icon and a set of buttons. Every single button in the message window is identified by a unique symbolic name (see the -type options below, iykyk π). After the message window is popped up, tk_messageBox waits for the user to select one of the buttons. Then it returns the symbolic name of the selected button. Main character behavior, fr fr. β¨
The following option-value pairs are supported:
-command stringβ Specifies the prefix of a Tcl command to invoke when the user closes the dialog. The actual command consists ofstringfollowed by a space and the name of the button clicked by the user to close the dialog. This is only available on macOS.
π macOS bestie alert: -command is macOS-only. No cap.
-default nameβnamegives the symbolic name of the default button for this message window ("ok","cancel", and so on). See-typefor a list of the symbolic names. If this option is not specified, the first button in the dialog will be made the default.-detail stringβ Specifies an auxiliary message to the main message given by the-messageoption. The message detail will be presented beneath the main message and, where supported by the OS, in a less emphasized font than the main message.-icon iconImageβ Specifies an icon to display.iconImagemust be one of the following:error,info,questionorwarning. If this option is not specified, then theinfoicon will be displayed.-message stringβ Specifies the message to display in this message box. The default value is an empty string.-parent windowβ Makeswindowthe logical parent of the message box. The message box is displayed on top of its parent window.-title titleStringβ Specifies a string to display as the title of the message box. The default value is an empty string.-type predefinedTypeβ Arranges for a predefined set of buttons to be displayed. The following values are possible forpredefinedType:abortretryignoreβ Displays three buttons whose symbolic names areabort,retryandignore.okβ Displays one button whose symbolic name isok. This is the default.okcancelβ Displays two buttons whose symbolic names areokandcancel.retrycancelβ Displays two buttons whose symbolic names areretryandcancel.yesnoβ Displays two buttons whose symbolic names areyesandno.yesnocancelβ Displays three buttons whose symbolic names areyes,noandcancel.
π₯ EXAMPLE π₯
Here's the example, copied exactly so you can vibe-check it π«Ά:
set answer [tk_messageBox -message "Really quit?" \
-icon question -type yesno \
-detail "Select \"Yes\" to make the application exit"]
switch -- $answer {
yes exit
no {tk_messageBox -message "I know you like this application!" \
-type ok}
}
π KEYWORDS π
message box
π Cute sign-off: this is tk_messageBox(n) from Tk 4.2 β source/version: Tk 4.2, and the original footer didn't print a date, so no cap, just vibes. Bye bestie! π«Άβ¨
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· 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) 1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms