beetlebug▾
/

ttk::separator

Makes a themed separator: a thin line between groups of widgets.

ttk::separator PATHNAME ?OPTION VALUE ...?

Description

Makes a themed separator with the name PATHNAME and the options of the call, and makes the command PATHNAME for the widget commands below. A separator is a horizontal or a vertical line. It asks for a size of 1 logical pixel, so give it its length with the geometry manager, such as pack -fill x or grid -sticky ew.

The parent of PATHNAME must exist, and PATHNAME must not. The class of the separator is TSeparator, the name of its style.

Widget commands

CommandDescription
ttk::separator stateGives the state flags of the widget, or turns flags on and off.
ttk::separator instateTests the state flags of the widget, and runs a script when they match.
ttk::separator identifyGives the name of the element of the widget at a point.
ttk::separator cgetGives the value of an option of the widget.
ttk::separator 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.
-orientorientationhorizontalorientThe direction of the line: horizontal or vertical.
-stylestyle nameemptystyleThe style of the widget, such as TSeparator or a style of the script such as Accent.TSeparator.
-takefocusboolean, empty, or scriptemptytakeFocusWhether the Tab key can move the focus to the widget.

-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 TSeparator, 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::separator .tspcl -class Fancy
> winfo class .tspcl
Fancy

% ttk::separator .tspcl3
> winfo class .tspcl3
TSeparator
% ttk::separator .tspcl2
> .tspcl2 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::separator .tspcu -cursor hand2
> .tspcu cget -cursor
hand2

ztk stores each value of the option with no check.

-orient ORIENT

The direction of the line: horizontal or vertical.

A horizontal separator is a line from left to right, and a vertical separator is a line from top to bottom.

Values: horizontal, vertical.

ttk::separator with -orient horizontal-orient horizontalttk::separator with -orient vertical-orient vertical
% ttk::separator .tspor -orient vertical
> .tspor cget -orient
vertical
% ttk::separator .tspor2 -orient diagonal
bad orient "diagonal": must be horizontal or vertical
-errorcode TCL LOOKUP INDEX orient diagonal

-style STYLE

The style of the widget, such as TSeparator or a style of the script such as Accent.TSeparator.

An empty value uses the style TSeparator. A style name of the script ends with the name of the base style, such as Accent.TSeparator, 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.TSeparator -foreground white
> ttk::separator .tspsy -style Accent.TSeparator
> .tspsy cget -style
Accent.TSeparator

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::separator .tsptf -takefocus 1
> .tsptf cget -takefocus
1

ztk stores each value of the option with no check.

Returns

PATHNAME.

Examples

% ttk::separator .line
> pack .line -fill x -pady 4
> update
> winfo height .line
1

% winfo class [ttk::separator .rule -orient vertical]
TSeparator

Errors

# The geometry manager sets the length of a separator.
% ttk::separator .x -length 10
unknown option "-length"
-errorcode TK LOOKUP OPTION -length

% ttk::separator .twice
> ttk::separator .twice
window name "twice" already exists in parent
-errorcode TK VALUE WINDOW EXISTS

# The parent .no does not exist.
% ttk::separator .no.s
bad window path name ".no"
-errorcode TK LOOKUP WINDOW .no

% ttk::separator
wrong # args: should be "ttk::separator 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