A dialog widget is used for displaying dialog boxes −
tk_dialog window title detailText bitmap default string1 ... stringn
The use of each of the above option of the widget is listed below in the following table and they need to be used in the same order −
|Sr.No.||Syntax & Description|
Determines the name of the top level window for dialog and any existing window by this name is destroyed.
Title for the widget.
Detail text for the widget.
Bitmap (in the form suitable for Tk_GetBitmap) to display in the top portion of the dialog, to the left of the text. If this is an empty string then no bitmap is displayed in the dialog. The available bitmaps in Tk include warning, question, questhead, info, hourglass, error, gray12, gray25, gray50, and gray75.
The index of button to be selected.
string1 ... stringn
The strings for buttons and it determines the number of buttons.
A simple example for dialog widget is shown below −
#!/usr/bin/wish set a [tk_dialog .myDialog "myTitle" "myDetail Text" questhead 0 "Yes" "No"]
When we run the above program, we will get the following output −