Tk - Notebook Widget



A tabbed widget that helps to switch between one of several pages, using an index tab. The syntax for notebook widget is shown below.

ttk::notebook notebookName options

Options

The options available for the notebook widget are listed below in the following table −

Sr.No. Syntax & Description
1

-height number

Used to set height for widget.

2

-width number

Sets the width for widget.

A simple example for notebook widget is shown below −

#!/usr/bin/wish

ttk::notebook .n  -width 100 -height 100
ttk::frame .n.f1; 
ttk::frame .n.f2; 
.n add .n.f1 -text "TabOne" 
.n add .n.f2 -text "TabTwo"
pack [label .n.f1.f2 -background red -foreground white -text "TabOne"]
pack [label .n.f2.f2 -background red -foreground white -text "TabTwo"]
pack .n

When we run the above program, we will get the following output −

Notebook Example
tk_mega_widgets.htm
Advertisements