
- 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 - Top Level Widgets
Top level widget is used to create a frame that is a new top level window. The syntax for top level widget is shown below −
toplevel topLevelName options
Options
The options available for the top level 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 | -height number Used to set height for widget. |
4 | -padx number Sets the padx for the widget. |
5 | -pady number Sets the pady for the widget. |
6 | -relief condition Sets the 3D relief for this widget. The condition may be raised, sunken, flat, ridge, solid, or groove. |
7 | -width number Sets the width for widget. |
A simple example for top level widget is shown below −
#!/usr/bin/wish toplevel .top -width 400 -height 100 -background red -relief ridge -borderwidth 8 -padx 10 -pady 10
When we run the above program, we will get the following output −

tk_basic_widgets.htm
Advertisements