beetlebug▾
/

panedwindow

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:

The parent of PATHNAME must exist, and PATHNAME must not. A panedwindow is a Panedwindow in CSS and for the option database.

Widget commands

CommandDescription
panedwindow addAdds each WIDGET as a pane.
panedwindow forgetRemoves each WIDGET from the panes.
panedwindow identifyGives the sash or the handle at a point.
panedwindow panecgetGives the value of an option of the pane of WIDGET.
panedwindow paneconfigureGives or sets the options of the pane of WIDGET.
panedwindow panesGives the widgets of the panes in their order.
panedwindow proxyShows or hides the proxy line of a drag of a sash.
panedwindow sashGives or moves the place of a sash.
panedwindow cgetGives the value of an option of the panedwindow.
panedwindow configureGives or sets the options of the panedwindow.

Options

OptionTypeDefaultDatabase nameDescription
-backgroundcolor#d9d9d9backgroundThe background color of the panedwindow.
-borderwidthscreen distance1borderWidthThe width of the border of the panedwindow.
-cursorcursor nameemptycursorThe shape of the pointer over the panedwindow.
-handlepadscreen distance8handlePadThe distance of the handle from the start of its sash.
-handlesizescreen distance8handleSizeThe size of the square handle of each sash.
-heightscreen distanceemptyheightThe height that the panedwindow asks for.
-opaqueresizeboolean1opaqueResizeWhether the panes change their size during a drag of a sash.
-orientorienthorizontalorientThe direction of the panes: horizontal or vertical.
-proxybackgroundcoloremptyproxyBackgroundThe color of the proxy line of a drag.
-proxyborderwidthscreen distance2proxyBorderWidthThe width of the border of the proxy line.
-proxyreliefreliefflatproxyReliefThe relief of the proxy line.
-reliefreliefflatreliefThe 3-D look of the border.
-sashcursorcursor nameemptysashCursorThe shape of the pointer over a sash.
-sashpadscreen distance0sashPadThe space at each side of a sash.
-sashreliefreliefflatsashReliefThe relief of the sashes.
-sashwidthscreen distance3sashWidthThe width of each sash.
-showhandleboolean0showHandleWhether each sash has a square handle.
-widthscreen distanceemptywidthThe 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.

panedwindow with -width 160 -height 60 -sashwidth 8 and -background {#fde68a}-background {#fde68a}panedwindow with -width 160 -height 60 -sashwidth 8 and -background {#bfdbfe}-background {#bfdbfe}
Each with -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.

panedwindow with -width 160 -height 60 -relief solid and -borderwidth 0-borderwidth 0panedwindow with -width 160 -height 60 -relief solid and -borderwidth 1-borderwidth 1panedwindow with -width 160 -height 60 -relief solid and -borderwidth 4-borderwidth 4
Each with -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.

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.

panedwindow with -width 160 -height 60 -showhandle 1 and -handlesize 8-handlesize 8panedwindow with -width 160 -height 60 -showhandle 1 and -handlesize 16-handlesize 16
Each with -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.

panedwindow with -width 160 and -height 40-height 40panedwindow with -width 160 and -height 80-height 80
Each with -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.

panedwindow with -width 160 -height 60 and -orient horizontal-orient horizontalpanedwindow with -width 160 -height 60 and -orient vertical-orient vertical
Each with -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.

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.

panedwindow with -width 160 -height 60 -borderwidth 4 and -relief flat-relief flatpanedwindow with -width 160 -height 60 -borderwidth 4 and -relief raised-relief raisedpanedwindow with -width 160 -height 60 -borderwidth 4 and -relief sunken-relief sunkenpanedwindow with -width 160 -height 60 -borderwidth 4 and -relief groove-relief groovepanedwindow with -width 160 -height 60 -borderwidth 4 and -relief ridge-relief ridgepanedwindow with -width 160 -height 60 -borderwidth 4 and -relief solid-relief solid
Each with -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
hand2

ztk 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.

panedwindow with -width 160 -height 60 and -sashpad 0-sashpad 0panedwindow with -width 160 -height 60 and -sashpad 8-sashpad 8
Each with -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.

panedwindow with -width 160 -height 60 and -sashwidth 2-sashwidth 2panedwindow with -width 160 -height 60 and -sashwidth 8-sashwidth 8panedwindow with -width 160 -height 60 and -sashwidth 16-sashwidth 16
Each with -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.

panedwindow with -width 160 -height 60 and -showhandle 0-showhandle 0panedwindow with -width 160 -height 60 and -showhandle 1-showhandle 1
Each with -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.

panedwindow with -height 60 and -width 100-width 100panedwindow with -height 60 and -width 160-width 160
Each with -height 60.
% panedwindow .width -width 4
> .width cget -width
4
% panedwindow .width2 -width x
bad screen distance "x"
-errorcode TK VALUE PIXELS

Returns

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

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also