beetlebug▾
/

ttk::panedwindow

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

CommandDescription
ttk::panedwindow addAdds a pane at the end, or sets the options of a pane.
ttk::panedwindow insertPuts a pane at a place in the row of panes.
ttk::panedwindow forgetRemoves a pane from the paned window.
ttk::panedwindow paneGives or sets the options of a pane.
ttk::panedwindow panesGives the panes in their order.
ttk::panedwindow sashposGives or sets the place of a sash.
ttk::panedwindow identifyGives the sash or the element at a point.
ttk::panedwindow stateGives the state flags of the widget, or turns flags on and off.
ttk::panedwindow instateTests the state flags of the widget, and runs a script when they match.
ttk::panedwindow cgetGives the value of an option of the widget.
ttk::panedwindow configureGives or sets the options of the widget.

Options

OptionTypeDefaultDatabase nameDescription
-classclass nameemptyThe class of the widget for the option database and for the bindings, set only at creation.
-cursorcursor nameemptycursorThe shape of the pointer over the widget.
-heightscreen distance0heightThe height that the paned window asks for, in place of the height of its panes.
-orientorientationverticalorientThe direction of the row of panes: vertical or horizontal.
-stylestyle nameemptystyleThe style of the widget, such as TPanedwindow or a style of the script such as Accent.TPanedwindow.
-takefocusboolean, empty, or scriptemptytakeFocusWhether the Tab key can move the focus to the widget.
-widthscreen distance0widthThe 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.

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
hand2

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

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

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

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

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

ttk::panedwindow with -height 60 and -width 100-width 100ttk::panedwindow with -height 60 and -width 160-width 160
Each with -height 60.
% ttk::panedwindow .tpwwi -width 200
> winfo reqwidth .tpwwi
200
% ttk::panedwindow .tpwwi2 -width x
bad screen distance "x"
-errorcode TK VALUE PIXELS

Returns

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

Facts

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

See also