beetlebug▾
/

ttk::style

Gives and sets the options of the styles and the themes of the themed widgets.

ttk::style SUBCOMMAND ?ARG ...?

Description

A style is a named set of options for the look of a themed widget, such as TButton. A style name of the script adds a prefix and a dot to a base style, such as Accent.TButton, and a widget uses it with -style. A style with no value of an option gets the value from its base style, and the root style . is the base of each style.

configure sets the default value of an option, and map sets values for some states, such as active or disabled. lookup gives the value that applies. A theme is a named set of styles, and theme use changes the theme of each themed widget.

In ztk, CSS draws each widget. configure and map change the look through CSS for the options -foreground, -background, -fieldbackground, -bordercolor, -borderwidth, -relief, -padding, -font, and -indicatorcolor. ztk stores the other options for lookup. layout and element create store their data with no effect on the look. Styling and themes has the CSS of ztk.

Subcommands

SubcommandDescription
ttk::style configureGives or sets the default values of the options of a style.
ttk::style mapGives or sets the values of the options of a style for some states.
ttk::style lookupGives the value of an option of a style that applies in a state.
ttk::style layoutGives or sets the layout of the elements of a style.
ttk::style themeLists, changes, and makes the themes.
ttk::style elementLists the elements, gives their options, and makes new elements.

Examples

% ttk::style configure Accent.TButton -foreground white -background #2563eb
> ttk::button .ok -text OK -style Accent.TButton
> ttk::style lookup Accent.TButton -foreground
white

Errors

% ttk::style
wrong # args: should be "ttk::style option ?arg ...?"
-errorcode TCL WRONGARGS

% ttk::style bogus
bad command "bogus": must be configure, map, lookup, layout, theme, or element
-errorcode NONE

Differences from Tcl

Facts

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

See also