Tcl Tutorial
Tk Tutorial
Tcl/Tk Useful Resources
Selected Reading
- Tcl - Regular Expressions
- Tcl - Built-in Functions
- Tcl - Error Handling
- Tcl - File I/O
- Tcl - Namespaces
- Tcl - Packages
- Tcl - Procedures
- Tcl - Dictionary
- Tcl - Lists
- Tcl - Strings
- Tcl - Arrays
- Tcl - Loops
- Tcl - Decisions
- Tcl - Operators
- Tcl - Variables
- Tcl - Data Types
- Tcl - Commands
- Tcl - Basic Syntax
- Tcl - Special Variables
- Tcl - Environment Setup
- Tcl - Overview
- Tcl - Home
Tk Tutorial
- Tk - Geometry Manager
- Tk - Windows Manager
- Tk - Events
- Tk - Images
- Tk - Fonts
- Tk - Mega Widgets
- Tk - Canvas Widgets
- Tk - Selection Widgets
- Tk - Layout Widgets
- Tk - Basic Widgets
- Tk - Widgets Overview
- Tk - Special Variables
- Tk - Environment
- Tk - Overview
Tcl/Tk Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Tk - Selection Widgets
Tk - Selection Widgets
Selection widgets are used to select different options in a Tk apppcation. The pst of available selection widgets are as shown below.
Sr.No. | Widgets & Description |
---|---|
1 | Widget that has a set of on/off buttons and labels, one of which may be selected. |
2 | Widget that has a set of on/off buttons and labels, many of which may be selected. |
3 | Widget that acts as holder for menu items. |
4 | Widget that displays a pst of cells, one or more of which may be selected. |
A simple Tk example is shown below using selection widgets −
#!/usr/bin/wish grid [frame .gender ] grid [label .label1 -text "Male" -textvariable myLabel1 ] grid [radiobutton .gender.maleBtn -text "Male" -variable gender -value "Male" -command "set myLabel1 Male"] -row 1 -column 2 grid [radiobutton .gender.femaleBtn -text "Female" -variable gender -value "Female" -command "set myLabel1 Female"] -row 1 -column 3 .gender.maleBtn select grid [label .myLabel2 -text "Range 1 not selected" -textvariable myLabelValue2 ] grid [checkbutton .chk1 -text "Range 1" -variable occupied1 -command {if {$occupied1 } { set myLabelValue2 {Range 1 selected} } else { set myLabelValue2 {Range 1 not selected} } }] proc setLabel {text} { .label configure -text $text }
When we run the above program, we will get the following output −
Advertisements