NAME

ttk::notebook -
Multi-paned container widget

SYNOPSIS

ttk::notebook pathName ?options?

pathName add pathName.subwindow ?options...?
pathName insert index pathName.subwindow ?options...?

DESCRIPTION

A notebook widget manages a collection of subpanes and displays a single one at a time. Each pane is associated with a tab, which the user may select to change the currently-displayed pane.

STANDARD OPTIONS

WIDGET OPTIONS

NameDatabase nameDatabase class
-heightheightHeight
 If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used.
-paddingpaddingPadding
 Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left.
-widthwidthWidth
 If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used.

TAB OPTIONS

The following options may be specified for individual notebook panes:

NameDatabase nameDatabase class
-statestateState
 Either normal, disabled or hidden. If disabled, then the tab is not selectable. If hidden, then the tab is not shown.
-stickystickySticky
 Specifies how the child pane is positioned within the pane area. Value is a string containing zero or more of the characters n, s, e, or w. Each letter refers to a side (north, south, east, or west) that the child window will "stick" to, as per the grid geometry manager.
-paddingpaddingPadding
 Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget -padding option.
-texttextText
 Specifies a string to be displayed in the tab.
-imageimageImage
 Specifies an image to display in the tab, which must have been created with the image create command.
-compoundcompoundCompound
 Specifies how to display the image relative to the text, in the case both -text and -image are present. See label(n) for legal values.
-underlineunderlineUnderline
 Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if ttk::notebook::enableTraversal is called.

WIDGET COMMAND

pathname add child ?options...?
Adds a new tab to the notebook. When the tab is selected, the child window will be displayed. child must be a direct child of the notebook window. See TAB OPTIONS for the list of available options.
pathname configure ?options?
See widget(n).
pathname cget option
See widget(n).
pathname forget tabid
Removes the tab specified by tabid, unmaps and unmanages the associated child window.
pathname index tabid
Returns the numeric index of the tab specified by tabid, or the total number of tabs if tabid is the string "end".
pathname insert pos subwindow options...
Inserts a pane at the specified position. pos is either the string end, an integer index, or the name of a managed subwindow. If subwindow is already managed by the notebook, moves it to the specified position. See TAB OPTIONS for the list of available options.
pathname instate statespec ?script...?
See widget(n).
pathname select ?tabid?
Selects the specified tab. The associated child pane will be displayed, and the previously-selected pane (if different) is unmapped. If tabid is omitted, returns the widget name of the currently selected pane.
pathname state ?statespec?
See widget(n).
pathname tab tabid ?-options ?value ...
Query or modify the options of the specific tab. If no -option is specified, returns a dictionary of the tab option values. If one -option is specified, returns the value of that option. Otherwise, sets the -options to the corresponding values. See TAB OPTIONS for the available options.
pathname tabs
Returns a list of all windows managed by the widget.

KEYBOARD TRAVERSAL

To enable keyboard traversal for a toplevel window containing a notebook widget $nb, call:

ttk::notebook::enableTraversal $nb

This will extend the bindings for the toplevel widget containing the notebook as follows:

Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook.

TAB IDENTIFIERS

The tabid argument to the above commands may take any of the following forms:

VIRTUAL EVENTS

The notebook widget generates a <<NotebookTabChanged>> virtual event after a new tab is selected.

EXAMPLE

notebook .nb
.nb add [frame .nb.f1] -text "First tab"
.nb add [frame .nb.f2] -text "Second tab"
.nb select .nb.f2
ttk::notebook::enableTraversal .nb

SEE ALSO

widget(n), grid(n)

KEYWORDS

pane, tab