ttk::panedwindow
Guide: Panes and tabs
Makes a themed paned window: panes in a row or a column, with sashes that the user drags to resize them.
ttk::panedwindow PATHNAME ?OPTION VALUE ...?
Description
Makes a themed paned window with the name PATHNAME and the options of the call, and makes the command PATHNAME for the widget commands below. Each pane is a widget that add or insert puts in the paned window. The paned window is the geometry manager of its panes. A sash between two panes moves with a drag, or with sashpos.
When the paned window gets more or less room, the panes share the change in the ratio of their -weight. A pane with the weight 0 keeps its size. A pane is named by an index from 0, by end, or by its path.
The parent of PATHNAME must exist, and PATHNAME must not. The class of the paned window is TPanedwindow, the name of its style.
Widget commands
| Command | Description |
|---|---|
ttk::panedwindow add | Adds a pane at the end, or sets the options of a pane. |
ttk::panedwindow insert | Puts a pane at a place in the row of panes. |
ttk::panedwindow forget | Removes a pane from the paned window. |
ttk::panedwindow pane | Gives or sets the options of a pane. |
ttk::panedwindow panes | Gives the panes in their order. |
ttk::panedwindow sashpos | Gives or sets the place of a sash. |
ttk::panedwindow identify | Gives the sash or the element at a point. |
ttk::panedwindow state | Gives the state flags of the widget, or turns flags on and off. |
ttk::panedwindow instate | Tests the state flags of the widget, and runs a script when they match. |
ttk::panedwindow cget | Gives the value of an option of the widget. |
ttk::panedwindow configure | Gives or sets the options of the widget. |
Options
| Option | Type | Default | Database name | Description |
|---|---|---|---|---|
-class | class name | empty | The class of the widget for the option database and for the bindings, set only at creation. | |
-cursor | cursor name | empty | cursor | The shape of the pointer over the widget. |
-height | screen distance | 0 | height | The height that the paned window asks for, in place of the height of its panes. |
-orient | orientation | vertical | orient | The direction of the row of panes: vertical or horizontal. |
-style | style name | empty | style | The style of the widget, such as TPanedwindow or a style of the script such as Accent.TPanedwindow. |
-takefocus | boolean, empty, or script | empty | takeFocus | Whether the Tab key can move the focus to the widget. |
-width | screen distance | 0 | width | The width that the paned window asks for, in place of the width of its panes. |
-class CLASS
The class of the widget for the option database and for the bindings, set only at creation.
The class name replaces the class of the style, such as TPanedwindow, in winfo class and in the bind tags of the widget. Give it in the call that makes the widget. A later configure of the option gives an error.
% ttk::panedwindow .tpwcl -class Fancy
> winfo class .tpwcl
Fancy
% ttk::panedwindow .tpwcl3
> winfo class .tpwcl3
TPanedwindow% ttk::panedwindow .tpwcl2
> .tpwcl2 configure -class Other
attempt to change read-only option
-errorcode NONE-cursor CURSOR
The shape of the pointer over the widget.
Each value side by side: the contact sheet of the cursors
A cursor name of Tk, such as hand2 or xterm. An empty value uses the cursor of the parent.
% ttk::panedwindow .tpwcu -cursor hand2
> .tpwcu cget -cursor
hand2ztk stores each value of the option with no check.
-height DISTANCE
The height that the paned window asks for, in place of the height of its panes.
A value above 0 sets the requested height. 0 asks for the height that the panes need.

-height 40
-height 80-width 160.% ttk::panedwindow .tpwhe -height 100
> winfo reqheight .tpwhe
100% ttk::panedwindow .tpwhe2 -height x
bad screen distance "x"
-errorcode TK VALUE PIXELS-orient ORIENT
The direction of the row of panes: vertical or horizontal.
A vertical paned window puts its panes from top to bottom, with horizontal sashes. A horizontal paned window puts its panes from left to right.
Values: horizontal, vertical.

-orient horizontal
-orient vertical-width 160 -height 60.% ttk::panedwindow .tpwor
> .tpwor cget -orient
vertical% ttk::panedwindow .tpwor2 -orient bogus
bad orient "bogus": must be horizontal or vertical
-errorcode TCL LOOKUP INDEX orient bogus-style STYLE
The style of the widget, such as TPanedwindow or a style of the script such as Accent.TPanedwindow.
An empty value uses the style TPanedwindow. A style name of the script ends with the name of the base style, such as Accent.TPanedwindow, and ttk::style configure and ttk::style map give it its options. A style with no settings looks like its base style.
% ttk::style configure Accent.TPanedwindow -foreground white
> ttk::panedwindow .tpwsy -style Accent.TPanedwindow
> .tpwsy cget -style
Accent.TPanedwindowztk stores each value of the option with no check, as Tk 8.6.16 does at creation.
-takefocus VALUE
Whether the Tab key can move the focus to the widget.
1 puts the widget in the order of the Tab key, and 0 leaves it out. The default empty value uses the default rule of Tk, and this widget is not in the order of the Tab key with it. A script runs with the path of the widget appended, and its result is the answer.
% ttk::panedwindow .tpwtf -takefocus 1
> .tpwtf cget -takefocus
1ztk stores each value of the option with no check.
-width DISTANCE
The width that the paned window asks for, in place of the width of its panes.
A value above 0 sets the requested width. 0 asks for the width that the panes need.

-width 100
-width 160-height 60.% ttk::panedwindow .tpwwi -width 200
> winfo reqwidth .tpwwi
200% ttk::panedwindow .tpwwi2 -width x
bad screen distance "x"
-errorcode TK VALUE PIXELSReturns
PATHNAME.
Examples
% ttk::panedwindow .split -orient horizontal
> ttk::frame .split.tree -width 100 -height 50
> ttk::frame .split.view -width 100 -height 50
> .split add .split.tree
> .split add .split.view -weight 1
> .split panes
.split.tree .split.view
% winfo class [ttk::panedwindow .panes]
TPanedwindow
Errors
# The style sets the size of a sash. The classic `panedwindow` has `-sashwidth`.
% ttk::panedwindow .x -sashwidth 4
unknown option "-sashwidth"
-errorcode TK LOOKUP OPTION -sashwidth
% ttk::panedwindow .twice
> ttk::panedwindow .twice
window name "twice" already exists in parent
-errorcode TK VALUE WINDOW EXISTS
# The parent .no does not exist.
% ttk::panedwindow .no.p
bad window path name ".no"
-errorcode TK LOOKUP WINDOW .no
% ttk::panedwindow
wrong # args: should be "ttk::panedwindow pathName ?-option value ...?"
-errorcode TCL WRONGARGS
Differences from Tcl
-cursoraccepts each value with no check. Tk 8.6.16 gives an error for a cursor name that does not exist.- The errors of
state,instate,identify, and of an unknown widget command have the error codeNONE. Tk 8.6.16 gives a code such asTTK VALUE STATEorTCL LOOKUP INDEX. The error of-underlinehas the codeTCL VALUE NUMBER, where Tk 8.6.16 givesTCL VALUE INTEGER. - The states
activeandhoverare one flag, sostate activeturns on both. - The errors of the widget commands, such as a bad pane or a wrong count of arguments, have the error code
NONE. Tk 8.6.16 gives a code such asTTK SLAVE INDEXorTCL WRONGARGS. The error of an integer has the codeTCL VALUE NUMBER, where Tk 8.6.16 givesTCL VALUE INTEGER. configure -orientafter creation changes the option. In Tk 8.6.16 the option is read-only after creation.- A negative
-weightof a pane is accepted. Tk 8.6.16 gives the error-weight must be nonnegative. identify elementgiveshsashfor the sash of a horizontal paned window. Tk 8.6.16 givesvsash, the name of a vertical sash between panes side by side.- The requested size has its value at once after
add. Tk 8.6.16 computes it at idle time, so it gives 1 beforeupdate.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1