Table of Contents

_________________________________________________________________

Name

notebook - Multi-paned container widget

Synopsis

ttk::notebook pathName ?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 cur- rently-displayed pane.

Standard Options

-class
-cursor -takefocus-style

See the options manual entry for details on the standard options.

Widget Options

Command-Line Name:-height
Database Name: height
Database Class: Height

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.

Command-Line Name:-padding
Database Name: padding
Database Class: Padding

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.

Command-Line Name:-width
Database Name: width
Database Class: Width

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:

Command-Line Name:-state
Database Name: state
Database Class: State

Either normal, disabled or hidden. If disabled, then the tab is not selectable. If hidden, then the tab is not shown.

Command-Line Name:-sticky
Database Name: sticky
Database Class: Sticky

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 let- ter refers to a side (north, south, east, or west) that the child window will stick to, as per the grid geometry manager.

Command-Line Name:-padding
Database Name: padding
Database Class: Padding

Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget -padding option.

Command-Line Name:-text
Database Name: text
Database Class: Text

Specifies a string to be displayed in the tab.

Command-Line Name:-image
Database Name: image
Database Class: Image

Specifies an image to display in the tab, which must have been created with the image create com- mand.

Command-Line Name:-compound
Database Name: compound
Database Class: Compound

Specifies how to display the image relative to the text, in the case both -text and -image are pre- sent. See label(n) for legal values.

Command-Line Name:-underline
Database Name: underline
Database Class: Underline

Specifies the integer index (0-based) of a charac- ter to underline in the text string. The under- lined 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 win- dow. See TAB OPTIONS for the list of available options.

pathname configure ?options?
See widget(n).

pathname cget option
See widget(n).

pathname forget index
Removes the tab specified by index, unmaps and unmanages the associated child window.

pathname index index
Returns the numeric index of the tab specified by index, or the total number of tabs if index is the string end".

pathname instate args...?
See widget(n).

pathname select index
Selects the specified tab; the associated child pane will be displayed, and the previously-selected pane (if different) is unmapped.

pathname state ?statespec?
See widget(n).

pathname tab index ?-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 speci- fied, 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 pane windows managed by the widget.

Keyboard Traversal

To enable keyboard traversal for a dialog box containing a notebook widget $nb, call:
ttk::notebook::enableTraversal $nb

This will extend the bindings for the toplevel widget con- taining the notebook as follows:

· Control-Tab selects the tab following the currently
selected one.
· Shift-Control-Tab selects the tab preceding the
currently selected one. BUG: this doesn't cur- rently work.
·
Alt-K, where K is the mnemonic (underlined) charac- ter of any tab, will select that tab.

Tab Indices

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

·
An integer between zero and the number of tabs;
·
The name of a child pane window;
·
A positional specification of the form @x,y", which identifies the tab
·
The literal string current", which identifies the currently-selected tab; or:
·
The literal string end", which returns the number of tabs (only valid for pathname index").

Virtual Events

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

Example

notebook .nb
ttk::notebook::enableTraversal .nb

See Also

widget(n) , grid(n)

Keywords

pane, tab


Table of Contents