Displaying a confirmation dialog

The tk_dialog command displays a modal message window and awaits the user's response. The value returned provides the index of the button selected: 0 for the leftmost; with the value increasing by 1 for each additional button. If the dialog is destroyed prior to the user making a selection, the return value is -1. All arguments must be provided.

The syntax is as follows:

	tk_dialog window title text bitmap default string…

Option

Interpretation

window

Name to assign to the dialog (for example confirmDialog).

title

Sets the text to be displayed in the dialog title bar.

text

Sets the message to be displayed

bitmap

Sets the bitmap (icon) to be displayed in the top of the dialog to the left of the text. If ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.