ttk::separator
Guide: Themed widgets (ttk)
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
| Command | Description |
|---|---|
ttk::separator state | Gives the state flags of the widget, or turns flags on and off. |
ttk::separator instate | Tests the state flags of the widget, and runs a script when they match. |
ttk::separator identify | Gives the name of the element of the widget at a point. |
ttk::separator cget | Gives the value of an option of the widget. |
ttk::separator 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. |
-orient | orientation | horizontal | orient | The direction of the line: horizontal or vertical. |
-style | style name | empty | style | The style of the widget, such as TSeparator or a style of the script such as Accent.TSeparator. |
-takefocus | boolean, empty, or script | empty | takeFocus | Whether 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.
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::separator .tspcu -cursor hand2
> .tspcu cget -cursor
hand2ztk 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.

-orient horizontal
-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.TSeparatorztk 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
1ztk 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
-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. - A separator asks for 1 pixel in each direction. In Tk 8.6.16 it asks for 2 pixels.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1