Updated 2016-01-16 05:51:23 by pooryorick

A dialog window is usually shown from an application as a temporary display to show information or to query the user. As the Tk toplevel command is a general purpose command for creating application windows there are a few things that should be set to make a dialog look standard.

Most window managers handle dialog windows differently to application windows. For instance a dialog may not show up in the taskbar and may have different frame decorations (the buttons on the outside edge) and even different animations when being mapped and unmapped. This is usually handled by setting the dialog toplevel to be transient with regards to the parent or owner window. This is often sufficient but on modern X11 systems if might also be helpful to set the toplevel type to dialog as well (Tk 8.6):
set dialog [toplevel $parent -class Dialog]
wm transient $dialog $owner
catch {wm attributes $dialog -type dialog}

Note that if you need a messagebox then you should use tk_messageBox which will use the native messagebox dialogs on windows and MacOSX.

For quick and dirty (and ugly) general purpose dialogs see the tk_dialog command.

There are some built-in dialogs which may defer to system native equivalents where available. See:


LV: When using wish, there are at times errors reported in what I presume are dialog boxes. When these boxes appear, the user is unable to copy and paste the information about the error into another file. Is there anything which a developer can do in these cases to make the error reporting better?

Dialog Widgets  edit

tk_messageBox
The builtin dialog widget.
A little value dialog, RS
Minimal, indeed.
An option dialog
Fairly minimal. With and without ttk.
A file properties dialog
Another little value dialog
A not-so-little value dialog
A dialog box with quite a few features.
Dialog
Part of incr Widgets.
tk-goodies
[bugant]: tk-goodies provides a nice dialogs package and they look more cleaner

and beauty than the tk_dialog ones. For more info, screenshot and download visit tk-goodies website [1]

See Also  edit

The Humble Dialog Box
Dialog box maker

See also the dialog in the tklib widget package. [2]