- Tcl Tutorial
- Tcl - Home
- Tcl - Overview
- Tcl - Environment Setup
- Tcl - Special Variables
- Tcl - Basic Syntax
- Tcl - Commands
- Tcl - Data Types
- Tcl - Variables
- Tcl - Operators
- Tcl - Decisions
- Tcl - Loops
- Tcl - Arrays
- Tcl - Strings
- Tcl - Lists
- Tcl - Dictionary
- Tcl - Procedures
- Tcl - Packages
- Tcl - Namespaces
- Tcl - File I/O
- Tcl - Error Handling
- Tcl - Built-in Functions
- Tcl - Regular Expressions
- Tk Tutorial
- Tk - Overview
- Tk - Environment
- Tk - Special Variables
- Tk - Widgets Overview
- Tk - Basic Widgets
- Tk - Layout Widgets
- Tk - Selection Widgets
- Tk - Canvas Widgets
- Tk - Mega Widgets
- Tk - Fonts
- Tk - Images
- Tk - Events
- Tk - Windows Manager
- Tk - Geometry Manager
- Tcl/Tk Useful Resources
- Tcl/Tk - Quick Guide
- Tcl/Tk - Useful Resources
- Tcl/Tk - Discussion
Tk - Dialog Widget
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 −