1ttk::notebook(n)               Tk Themed Widget               ttk::notebook(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ttk::notebook - Multi-paned container widget
9

SYNOPSIS

11       ttk::notebook pathname ?options...?
12       pathname add window ?options...?
13       pathname insert index window ?options...?
14_________________________________________________________________
15

DESCRIPTION

17       A  ttk::notebook  widget manages a collection of windows and displays a
18       single one at a time.  Each slave window  is  associated  with  a  tab,
19       which the user may select to change the currently-displayed window.
20

STANDARD OPTIONS

22       -class                -cursor              -takefocus
23       -style
24
25       See the ttk_widget manual entry for details on the standard options.
26

WIDGET-SPECIFIC OPTIONS

28       [-height height]  If  present  and  greater  than  zero,  specifies the
29       desired height of the pane area  (not  including  internal  padding  or
30       tabs).   Otherwise,  the  maximum  height of all panes is used.  [-pad‐
31       ding padding] Specifies the amount of extra space  to  add  around  the
32       outside  of  the  notebook.  The padding is a list of up to four length
33       specifications left top right bottom.  If fewer than four elements  are
34       specified,  bottom  defaults  to  top,  right defaults to left, and top
35       defaults to left.  [-width width] If present  and  greater  than  zero,
36       specifies  the  desired  width of the pane area (not including internal
37       padding).  Otherwise, the maximum width of all panes is used.
38

TAB OPTIONS

40       The following options may be specified for individual  notebook  panes:
41       [-state state]  Either  normal,  disabled or hidden.  If disabled, then
42       the tab is not selectable.  If hidden,  then  the  tab  is  not  shown.
43       [-sticky sticky]  Specifies  how  the slave window is positioned within
44       the pane area.  Value is a string containing zero or more of the  char‐
45       acters  n,  s,  e,  or  w.  Each letter refers to a side (north, south,
46       east, or west) that the slave window will “stick” to, as per  the  grid
47       geometry  manager.   [-padding padding]  Specifies  the amount of extra
48       space to add between the notebook and this pane.  Syntax is the same as
49       for  the widget -padding option.  [-text text] Specifies a string to be
50       displayed in the tab.  [-image image] Specifies an image to display  in
51       the  tab.   See ttk_widget(n) for details.  [-compound compound] Speci‐
52       fies how to display the image relative to the text, in  the  case  both
53       -text and -image are present.  See label(n) for legal values.  [-under‐
54       line underline] Specifies the integer index (0-based) of a character to
55       underline  in  the  text  string.  The underlined character is used for
56       mnemonic activation if ttk::notebook::enableTraversal is called.
57

TAB IDENTIFIERS

59       The tabid argument to the following commands may take any of  the  fol‐
60       lowing forms:
61
62       ·      An integer between zero and the number of tabs;
63
64       ·      The name of a slave window;
65
66       ·      A  positional specification of the form “@x,y”, which identifies
67              the tab
68
69       ·      The literal string “current”, which  identifies  the  currently-
70              selected tab; or:
71
72       ·      The literal string “end”, which returns the number of tabs (only
73              valid for “pathname index”).
74

WIDGET COMMAND

76       pathname add window ?options...?
77              Adds a new tab to the notebook.  See TAB OPTIONS for the list of
78              available  options.  If window is currently managed by the note‐
79              book but hidden, it is restored to its previous position.
80
81       pathname configure ?options?
82              See ttk::widget(n).
83
84       pathname cget option
85              See ttk::widget(n).
86
87       pathname forget tabid
88              Removes the tab specified by tabid,  unmaps  and  unmanages  the
89              associated window.
90
91       pathname hide tabid
92              Hides  the  tab  specified  by  tabid.  The tab will not be dis‐
93              played, but the associated window remains managed by  the  note‐
94              book  and  its  configuration  remembered.   Hidden  tabs may be
95              restored with the add command.
96
97       pathname identify component x y
98              Returns the name of the element under the point given by  x  and
99              y,  or the empty string if no component is present at that loca‐
100              tion.  The following subcommands are supported:
101
102              pathname identify element x y
103                     Returns the name of the element at  the  specified  loca‐
104                     tion.
105
106              pathname identify tab x y
107                     Returns the index of the tab at the specified location.
108
109       pathname index tabid
110              Returns  the numeric index of the tab specified by tabid, or the
111              total number of tabs if tabid is the string “end”.
112
113       pathname insert pos subwindow options...
114              Inserts a pane at the specified position.   pos  is  either  the
115              string  end,  an integer index, or the name of a managed subwin‐
116              dow.  If subwindow is already managed by the notebook, moves  it
117              to  the  specified  position.   See  TAB OPTIONS for the list of
118              available options.
119
120       pathname instate statespec ?script...?
121              See ttk::widget(n).
122
123       pathname select ?tabid?
124              Selects the specified tab.  The associated slave window will  be
125              displayed,  and the previously-selected window (if different) is
126              unmapped.  If tabid is omitted, returns the widget name  of  the
127              currently selected pane.
128
129       pathname state ?statespec?
130              See ttk::widget(n).
131
132       pathname tab tabid ?-option ?value ...
133              Query  or modify the options of the specific tab.  If no -option
134              is specified, returns a dictionary of the tab option values.  If
135              one  -option  is  specified,  returns  the value of that option.
136              Otherwise, sets the -options to the corresponding  values.   See
137              TAB OPTIONS for the available options.
138
139       pathname tabs
140              Returns the list of windows managed by the notebook.
141

KEYBOARD TRAVERSAL

143       To  enable  keyboard traversal for a toplevel window containing a note‐
144       book widget $nb, call:
145              ttk::notebook::enableTraversal $nb
146
147       This will extend the bindings for the toplevel  window  containing  the
148       notebook as follows:
149
150       ·      Control-Tab  selects  the  tab  following the currently selected
151              one.
152
153       ·      Shift-Control-Tab  selects  the  tab  preceding  the   currently
154              selected one.
155
156       ·      Alt-K,  where  K  is  the mnemonic (underlined) character of any
157              tab, will select that tab.
158
159       Multiple notebooks in a single toplevel may be enabled  for  traversal,
160       including  nested  notebooks.   However,  notebook traversal only works
161       properly if all panes are direct children of the notebook.
162

VIRTUAL EVENTS

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

EXAMPLE

168              pack [ttk::notebook .nb]
169              .nb add [frame .nb.f1] -text "First tab"
170              .nb add [frame .nb.f2] -text "Second tab"
171              .nb select .nb.f2
172              ttk::notebook::enableTraversal .nb
173

SEE ALSO

175       ttk::widget(n), grid(n)
176

KEYWORDS

178       pane, tab
179
180
181
182Tk                                    8.5                     ttk::notebook(n)
Impressum