ttk_notebook
-
NAME
- ttk::notebook — Multi-paned container widget
- SYNOPSIS
- DESCRIPTION
- STANDARD OPTIONS
-
-class, undefined, undefined
- -cursor, cursor, Cursor
- -style, style, Style
- -takefocus, takeFocus, TakeFocus
- -cursor, cursor, Cursor
- WIDGET-SPECIFIC OPTIONS
- TAB OPTIONS
-
-state, state, State
- -sticky, sticky, Sticky
- -padding, padding, Padding
- -text, text, Text
- -image, image, Image
- -compound, compound, Compound
- -underline, underline, Underline
- -sticky, sticky, Sticky
- TAB IDENTIFIERS
- WIDGET COMMAND
- KEYBOARD TRAVERSAL
- VIRTUAL EVENTS
- EXAMPLE
- SEE ALSO
- KEYWORDS
Name
ttk::notebook — Multi-paned container widgetSynopsis
ttk::notebook pathname ?options...?pathname add window ?options...?
pathname insert index window ?options...?
Description
A ttk::notebook widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a tab, which the user may select to change the currently-displayed window.Standard options
-
-class, undefined, undefined
- -cursor, cursor, Cursor
- -style, style, Style
- -takefocus, takeFocus, TakeFocus
- -cursor, cursor, Cursor
Widget-specific options
- Command-Line Name: -height
- Database Name: height
- Database Class: Height
- Database Name: 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
- Database Name: 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
- Database Name: 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
- Database Name: 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
- Database Name: sticky
- Specifies how the slave window 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 slave window will “stick” to, as per the grid geometry manager.
- Command-Line Name: -padding
- Database Name: padding
- Database Class: Padding
- Database Name: 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
- Database Name: text
- Specifies a string to be displayed in the tab.
- Command-Line Name: -image
- Database Name: image
- Database Class: Image
- Database Name: image
- Specifies an image to display in the tab. See ttk_widget(n) for details.
- Command-Line Name: -compound
- Database Name: compound
- Database Class: Compound
- Database Name: compound
- 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.
- Command-Line Name: -underline
- Database Name: underline
- Database Class: Underline
- Database Name: underline
- 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.
Tab identifiers
The tabid argument to the following commands may take any of the following forms:- An integer between zero and the number of tabs;
- The name of a slave 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”).
Widget command
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 window containing the notebook as follows:
- Control-Tab selects the tab following the currently selected one.
- Control-Shift-Tab selects the tab preceding the currently selected one.
- Alt-K, where K is the mnemonic (underlined) character of any tab, will select that tab.
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.
Virtual events
The notebook widget generates a <<NotebookTabChanged>> virtual event after a new tab is selected.Example
pack [ttk::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
ttk::widget, gridCopyright © 2004 Joe English
Licensed under Tcl/Tk terms
https://www.tcl.tk/man/tcl/TkCmd/ttk_notebook.htm