Tk - Dialog Widget


Advertisements

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
1

window

Determines the name of the top level window for dialog and any existing window by this name is destroyed.

2

title

Title for the widget.

3

detailText

Detail text for the widget.

4

bitmap

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.

5

default

The index of button to be selected.

6

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 −

Dialog Widget Example
tk_mega_widgets.htm
Advertisements