panedwindow
Guide: Panes and tabs
Makes a panedwindow: a row or a column of panes with sashes that the user drags to change their sizes.
panedwindow PATHNAME ?OPTION VALUE ...?
Description
Makes a panedwindow widget with the name PATHNAME and the options of the call, and makes the command PATHNAME for the widget commands below. add puts other widgets into the panedwindow as panes. A sash is between each two panes, and a drag of a sash moves the space from one pane to the other. -orient puts the panes side by side or one above the other.
A panedwindow is a geometry manager for its panes: a widget in a pane must not be managed by pack, grid, or place too. Each pane has options of its own, which add and paneconfigure set:
-after WIDGETand-before WIDGET: the place of the pane in the order of the panes.-width DISTANCEand-height DISTANCE: the size of the pane. An empty value uses the size that the widget asks for.-minsize DISTANCE: the smallest size of the pane along the-orientdirection.-padx DISTANCEand-pady DISTANCE: the space around the widget in its pane.-sticky STYLE: the sides of the pane that the widget sticks to, a string ofn,e,s, andw.-stretch WHEN: which panes get the extra space:always,first,last,middle, ornever.-hide BOOLEAN: a hidden pane has no space and no sash.
The parent of PATHNAME must exist, and PATHNAME must not. A panedwindow is a Panedwindow in CSS and for the option database.
Widget commands
| Command | Description |
|---|---|
panedwindow add | Adds each WIDGET as a pane. |
panedwindow forget | Removes each WIDGET from the panes. |
panedwindow identify | Gives the sash or the handle at a point. |
panedwindow panecget | Gives the value of an option of the pane of WIDGET. |
panedwindow paneconfigure | Gives or sets the options of the pane of WIDGET. |
panedwindow panes | Gives the widgets of the panes in their order. |
panedwindow proxy | Shows or hides the proxy line of a drag of a sash. |
panedwindow sash | Gives or moves the place of a sash. |
panedwindow cget | Gives the value of an option of the panedwindow. |
panedwindow configure | Gives or sets the options of the panedwindow. |
Options
| Option | Type | Default | Database name | Description |
|---|---|---|---|---|
-background | color | #d9d9d9 | background | The background color of the panedwindow. |
-borderwidth | screen distance | 1 | borderWidth | The width of the border of the panedwindow. |
-cursor | cursor name | empty | cursor | The shape of the pointer over the panedwindow. |
-handlepad | screen distance | 8 | handlePad | The distance of the handle from the start of its sash. |
-handlesize | screen distance | 8 | handleSize | The size of the square handle of each sash. |
-height | screen distance | empty | height | The height that the panedwindow asks for. |
-opaqueresize | boolean | 1 | opaqueResize | Whether the panes change their size during a drag of a sash. |
-orient | orient | horizontal | orient | The direction of the panes: horizontal or vertical. |
-proxybackground | color | empty | proxyBackground | The color of the proxy line of a drag. |
-proxyborderwidth | screen distance | 2 | proxyBorderWidth | The width of the border of the proxy line. |
-proxyrelief | relief | flat | proxyRelief | The relief of the proxy line. |
-relief | relief | flat | relief | The 3-D look of the border. |
-sashcursor | cursor name | empty | sashCursor | The shape of the pointer over a sash. |
-sashpad | screen distance | 0 | sashPad | The space at each side of a sash. |
-sashrelief | relief | flat | sashRelief | The relief of the sashes. |
-sashwidth | screen distance | 3 | sashWidth | The width of each sash. |
-showhandle | boolean | 0 | showHandle | Whether each sash has a square handle. |
-width | screen distance | empty | width | The width that the panedwindow asks for. |
-background COLOR
The background color of the panedwindow.
The color behind the content. -bg is the same option. A color is a name such as red, or #RGB, #RRGGBB, or #RRRRGGGGBBBB.

-background {#fde68a}
-background {#bfdbfe}-width 160 -height 60 -sashwidth 8.% panedwindow .background -background {#336699}
> .background cget -background
#336699% panedwindow .background2 -background nocolor
unknown color name "nocolor"
-errorcode TK LOOKUP COLOR nocolor-borderwidth DISTANCE
The width of the border of the panedwindow.
The width of the border around the panedwindow. -bd is the same option. A distance is a count of pixels, or a number with c, i, m, or p for centimeters, inches, millimeters, or points.

-borderwidth 0
-borderwidth 1
-borderwidth 4-width 160 -height 60 -relief solid.% panedwindow .borderwidth -borderwidth 4
> .borderwidth cget -borderwidth
4% panedwindow .borderwidth2 -borderwidth x
bad screen distance "x"
-errorcode TK VALUE PIXELS-cursor CURSOR
The shape of the pointer over the panedwindow.
Each value side by side: the contact sheet of the cursors
A cursor name of Tk, such as hand2 or xterm. A value that starts with @ names a file. An empty value uses the cursor of the parent.
% panedwindow .cursor -cursor hand2
> .cursor cget -cursor
hand2% panedwindow .cursor2 -cursor nocursor
bad cursor spec "nocursor"
-errorcode TK VALUE CURSOR-handlepad DISTANCE
The distance of the handle from the start of its sash.
With -showhandle, the handle of each sash is this distance from the top of a vertical sash or the left end of a horizontal sash.
% panedwindow .handlepad -handlepad 4
> .handlepad cget -handlepad
4% panedwindow .handlepad2 -handlepad x
bad screen distance "x"
-errorcode TK VALUE PIXELS-handlesize DISTANCE
The size of the square handle of each sash.
With -showhandle, the panedwindow draws a square of this side on each sash.

-handlesize 8
-handlesize 16-width 160 -height 60 -showhandle 1.% panedwindow .handlesize -handlesize 4
> .handlesize cget -handlesize
4% panedwindow .handlesize2 -handlesize x
bad screen distance "x"
-errorcode TK VALUE PIXELS-height DISTANCE
The height that the panedwindow asks for.
An empty value, the default, asks for the height of the panes and the sashes.

-height 40
-height 80-width 160.% panedwindow .height -height 4
> .height cget -height
4% panedwindow .height2 -height x
bad screen distance "x"
-errorcode TK VALUE PIXELS-opaqueresize BOOLEAN
Whether the panes change their size during a drag of a sash.
With a true value, the panes change their size at each move of a drag. With a false value, the panedwindow shows a proxy line during the drag, and the panes change their size at the release.
% panedwindow .opaqueresize -opaqueresize 0
> .opaqueresize cget -opaqueresize
0% panedwindow .opaqueresize2 -opaqueresize maybe
expected boolean value but got "maybe"
-errorcode TCL VALUE NUMBER-orient WORD
The direction of the panes: horizontal or vertical.
horizontal puts the panes side by side, from left to right, and vertical puts them from top to bottom.
Values: horizontal, vertical.

-orient horizontal
-orient vertical-width 160 -height 60.% panedwindow .orient -orient vertical
> .orient cget -orient
vertical% panedwindow .orient2 -orient bogus
bad orient "bogus": must be horizontal or vertical
-errorcode TCL LOOKUP INDEX orient bogus-proxybackground COLOR
The color of the proxy line of a drag.
In Tk, the proxy line of -opaqueresize 0 has this color. ztk stores the value with no effect.
% panedwindow .proxybackground -proxybackground {#336699}
> .proxybackground cget -proxybackground
#336699% panedwindow .proxybackground2 -proxybackground nocolor
unknown color name "nocolor"
-errorcode TK LOOKUP COLOR nocolor-proxyborderwidth DISTANCE
The width of the border of the proxy line.
In Tk, the proxy line has a 3-D border of this width. ztk stores the value with no effect.
% panedwindow .proxyborderwidth -proxyborderwidth 4
> .proxyborderwidth cget -proxyborderwidth
4% panedwindow .proxyborderwidth2 -proxyborderwidth x
bad screen distance "x"
-errorcode TK VALUE PIXELS-proxyrelief RELIEF
The relief of the proxy line.
In Tk, the proxy line has this 3-D look. ztk stores the value with no effect.
Values: flat, groove, raised, ridge, solid, sunken.
% panedwindow .proxyrelief -proxyrelief groove
> .proxyrelief cget -proxyrelief
groove% panedwindow .proxyrelief2 -proxyrelief bumpy
bad relief "bumpy": must be flat, groove, raised, ridge, solid, or sunken
-errorcode TCL LOOKUP INDEX relief bumpy-relief RELIEF
The 3-D look of the border.
Each value side by side: the contact sheet of the reliefs
The style of the border: raised and sunken look 3-D, and groove and ridge are lines. The theme draws the border, and the CSS of the theme can give a relief its own look with border-style.
Values: flat, groove, raised, ridge, solid, sunken.

-relief flat
-relief raised
-relief sunken
-relief groove
-relief ridge
-relief solid-width 160 -height 60 -borderwidth 4.% panedwindow .relief -relief groove
> .relief cget -relief
groove% panedwindow .relief2 -relief bumpy
bad relief "bumpy": must be flat, groove, raised, ridge, solid, or sunken
-errorcode TCL LOOKUP INDEX relief bumpy-sashcursor CURSOR
The shape of the pointer over a sash.
An empty value uses a cursor of two arrows along the -orient direction.
% panedwindow .sashcursor -sashcursor hand2
> .sashcursor cget -sashcursor
hand2ztk stores each value with no check. Tk 8.6.16 gives an error for a name that is not a cursor.
-sashpad DISTANCE
The space at each side of a sash.
The panedwindow leaves this space between a sash and the panes next to it.

-sashpad 0
-sashpad 8-width 160 -height 60.% panedwindow .sashpad -sashpad 4
> .sashpad cget -sashpad
4% panedwindow .sashpad2 -sashpad x
bad screen distance "x"
-errorcode TK VALUE PIXELS-sashrelief RELIEF
The relief of the sashes.
In Tk, each sash has this 3-D look. ztk stores the value with no effect: the theme draws the sashes.
Values: flat, groove, raised, ridge, solid, sunken.
% panedwindow .sashrelief -sashrelief groove
> .sashrelief cget -sashrelief
groove% panedwindow .sashrelief2 -sashrelief bumpy
bad relief "bumpy": must be flat, groove, raised, ridge, solid, or sunken
-errorcode TCL LOOKUP INDEX relief bumpy-sashwidth DISTANCE
The width of each sash.
The size of a sash across the -orient direction. A distance is a count of pixels, or a number with c, i, m, or p for centimeters, inches, millimeters, or points.

-sashwidth 2
-sashwidth 8
-sashwidth 16-width 160 -height 60.% panedwindow .sashwidth -sashwidth 4
> .sashwidth cget -sashwidth
4% panedwindow .sashwidth2 -sashwidth x
bad screen distance "x"
-errorcode TK VALUE PIXELS-showhandle BOOLEAN
Whether each sash has a square handle.
With a true value, the panedwindow draws a handle of -handlesize on each sash. A drag of the handle or of the sash moves the sash.

-showhandle 0
-showhandle 1-width 160 -height 60.% panedwindow .showhandle -showhandle 1
> .showhandle cget -showhandle
1% panedwindow .showhandle2 -showhandle maybe
expected boolean value but got "maybe"
-errorcode TCL VALUE NUMBER-width DISTANCE
The width that the panedwindow asks for.
An empty value, the default, asks for the width of the panes and the sashes.

-width 100
-width 160-height 60.% panedwindow .width -width 4
> .width cget -width
4% panedwindow .width2 -width x
bad screen distance "x"
-errorcode TK VALUE PIXELSReturns
PATHNAME.
Examples
% panedwindow .split
> text .split.left -width 20
> text .split.right -width 40
> .split add .split.left .split.right
> .split panes
.split.left .split.right
% panedwindow .stack -orient vertical
> label .stack.top -text Top
> .stack add .stack.top -minsize 50
> .stack panecget .stack.top -minsize
50
% winfo class [panedwindow .go]
Panedwindow
Errors
% panedwindow .x -foo 1
unknown option "-foo"
-errorcode TK LOOKUP OPTION -foo
% panedwindow .twice
> panedwindow .twice
window name "twice" already exists in parent
-errorcode TK VALUE WINDOW EXISTS
# The parent .no does not exist.
% panedwindow .no.b
bad window path name ".no"
-errorcode TK LOOKUP WINDOW .no
% panedwindow
wrong # args: should be "panedwindow pathName ?-option value ...?"
-errorcode TCL WRONGARGS
Differences from Tcl
- A panedwindow that is smaller than its panes, with no pane that can stretch, cuts the last pane at its end.
- Over a sash, the pointer shape changes with no change of
-cursor. forgetof a widget that does not exist gives the errorbad window path name. Tk 8.6.16 gives the message as the result, with no error.-sashcursoraccepts a name that is not a cursor. Tk 8.6.16 gives the errorbad cursor spec.- An error of a widget command has the
-errorcodeNONE. Tk 8.6.16 gives a code such asTK PANEDWINDOW UNMANAGED,TK VALUE STICKY, orTCL WRONGARGS. -proxybackground,-proxyborderwidth,-proxyrelief, and-sashreliefare stored with no effect. The theme draws the sashes.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1