- 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 - Scrollbar Widget
Scrollbar widget is a scrolling widget that can work without a text or canvas widgets. The syntax for scrollbar widget is shown below.
scrollbar scrollbarName options
Options
The options available for the scrollbar widget are listed below in table.
Sr.No. | Syntax & Description |
---|---|
1 | -background color Used to set background color for widget. |
2 | -borderwidth width Used to draw with border in 3D effects. |
3 | -orien orientation Sets the orientation for widget. It can be either horizontal or vertical. |
4 | -relief condition Sets the 3D relief for this widget. The condition may be raised, sunken, flat, ridge, solid, or groove. |
5 | -command command Command links view to scrollbar widget. |
A simple example for scrollbar widget is shown below −
#!/usr/bin/wish grid [tk::listbox .l -yscrollcommand ".s1 set" -xscrollcommand ".s2 set" -height 5 -width 20] -column 0 -row 0 -sticky nwes grid [ttk::scrollbar .s1 -command ".l yview" -orient vertical -background yellow -borderwidth 5 -relief ridge] -column 1 -row 0 -sticky ns grid [ttk::scrollbar .s2 -command ".l xview" -orient horizontal -background yellow -borderwidth 5 -relief ridge] -column 0 -row 1 -sticky ew for {set index 0} {$index<100} {incr index} { .l insert end "A long line of text for testing scrollbar." }
When we run the above program, we will get the following output −
tk_mega_widgets.htm
Advertisements