Panes and tabs
Live: the Panes and Tabs cards of the gallery.
panedwindow and ttk::panedwindow
panedwindow .p
listbox .p.list -width 10
.p.list insert end Inbox Drafts Sent Archive Trash
.p.list selection set 0
ttk::panedwindow .p.right -orient vertical
label .p.right.mail -text "Drag a sash"
label .p.right.info -text "This pane gets twice the space"
.p.right add .p.right.mail -weight 1
.p.right add .p.right.info -weight 2
.p add .p.list -stretch never
.p add .p.right -stretch always
pack .p -fill both -expand 1 -padx 8 -pady 8

The details of panedwindow and ttk::panedwindow
panedwindowputs its panes in a row (-orient horizontal) or a column, with a sash between two panes. It has the options, the pane options, and the subcommands of Tk 8.6:add,forget,identify,panecget,paneconfigure,panes,proxy, andsashwithcoord,dragto,mark, andplace.- A pane has the size of its widget, or its
-widthor-height, plus-padxor-pady.-stickyplaces the widget in its pane.-stretchpicks the panes that get the extra space, or lose space, when the panedwindow changes size. A sash move stops at the-minsizeof the panes. ttk::panedwindowhasadd,forget,identify,insert,pane,panes, andsashpos. A change of the size goes to the panes in proportion to their-weight.sashposputs a sash between its neighbors and pushes them when it must.- A press on a sash and a drag move it. The panes follow the pointer in each frame, and the render thread moves the sash with the pointer while a script is busy. With
-opaqueresize 0, a drag moves a line, and the release moves the sash.-showhandledraws a handle on each sash. - The pointer shape is a resize arrow over a sash, or the shape of
-sashcursor. - The modern theme draws a sash as a thin line in the part
::sash. The sash under the pointer or in a drag fades to the part::sash-activein 120 ms.
ttk::notebook
ttk::notebook .n
foreach {page title} {general General network Network advanced Advanced} {
ttk::frame .n.$page -padding 12
.n add .n.$page -text $title -underline 0
}
set login 1
set menubar 0
ttk::checkbutton .n.general.a -text "Open at login" -variable login
ttk::checkbutton .n.general.b -text "Show in the menu bar" -variable menubar
pack .n.general.a .n.general.b -anchor w -pady 2
ttk::label .n.network.l -text "Proxy: none"
pack .n.network.l -anchor w
.n tab .n.advanced -state disabled
ttk::notebook::enableTraversal .n
pack .n -fill both -expand 1 -padx 8 -pady 8


The details of ttk::notebook
ttk::notebookhas the subcommands of Tk 8.6:add,forget,hide,identify,index,insert,select,tab, andtabs, withinstateandstate. A tab isnormal,disabled, orhidden, and it has-text,-underline,-padding, and-sticky.- A click on a tab selects it.
LeftandRightmove to the next tab that is not disabled, andControl-TabandControl-Shift-Tabcycle the tabs.ttk::notebook::enableTraversaladds these keys to the whole window, withControl-Page Up,Control-Page Down, andAltwith the letter of-underline. - Each change of the selected tab sends
<<NotebookTabChanged>>after the script that made the change. - The line under the selected tab slides to the new tab in 200 ms, and the new page fades in over 150 ms. A change during the slide starts from the shown place.
- The parts
::tab,::tab-selected,::tab-hover,::tab-disabled,::indicator, and::clientofTNotebookaccept CSS rules.