Notebook#
Notebook is the native ttk tabbed container that shows one child pane at
a time (ttk.Notebook), themed by ttkbootstrap. This page is the
complete reference for its options, methods, and styling.
Options#
Each option can be set in the constructor and changed later with configure().
Option |
Type |
Description |
|---|---|---|
|
|
Constructor keyword. An accent color, optionally with a variant. See Styling options for the available styles. |
|
|
Extra space around the pane area, in pixels (a single value, or per-side). |
|
|
The requested width of the pane area, in pixels. |
|
|
The requested height of the pane area, in pixels. |
|
|
The mouse cursor over the notebook (see Cursors). |
|
|
Whether the notebook accepts keyboard focus during traversal. |
Methods#
- add(child, **kw)
Add a pane for
childas a new tab.kwincludetext,image,compound,underline,sticky, andpadding.- Returns:
None.
- insert(pos, child, **kw)
Insert a pane at position
pos.- Returns:
None.
- hide(tab_id)
Hide a tab (it is kept in the widget and can be restored).
- Returns:
None.
- select(tab_id=None)
Select
tab_id, or return the currently selected tab’s widget name.- Return type:
- index(tab_id)
Return the numeric index of a tab.
- Return type:
- tab(tab_id, option=None, **kw)
Query or set a tab’s options.
- tabs()
Return the widget names of all tabs.
- Return type:
- enable_traversal()
Enable Ctrl-Tab / mnemonic keyboard traversal between tabs.
- Returns:
None.
Styling options#
This section is for changing how the notebook looks. Define a style with
style.configure(...) (and style.map(...) for per-state colors), then
apply it with Notebook(style=...).
Bootstyle mapping#
Any of the accent colors – primary, secondary, success, info, warning, danger, light, dark – substitutes for primary below. neutral does not apply to this family.
|
ttk style name |
|---|---|
|
|
Layout (elements)#
The widget is drawn from these nested parts. Each is an element you can target by name in a custom layout:
Notebook.client
Configurable style options#
Options you can set with style.configure(...) / style.map(...):
background, bordercolor, darkcolor, lightcolor
Supported states#
This style declares no style.map(...) overrides; any state-dependent appearance is drawn from its image elements.
Hand-styling example#
import ttkbootstrap as ttk
app = ttk.App()
style = app.style
style.configure("my.TNotebook", background="#3498db", foreground="white")
ttk.Notebook(app, style="my.TNotebook").pack(padx=8, pady=8)
app.mainloop()
See also#
Notebook catalog page — usage, screenshots, and examples.
Tk ttk::notebook manual page — the canonical upstream reference (Tcl 8.6).