Version 23 of ttk::style examples

Updated 2010-09-06 02:45:58 by RLE

Introduction

This page is intended to collect in one place various bits of knowledge gained through much trial, many errors, and some reading the C code of the Tile widget set. The intent is to not have to repeat the trial, error, or reading in order to remember how to utilize the ttk::style command to style various ttk:: widgets.

treeview

-fieldbackground
Configures the background color of the unused portion of a treeview widget (any area not covered by rows of data).

Example:
ttk::style configure Treeview -fieldbackground color
-background
Configures the background color of rows that contain data values when applied to a .Row style sub-selector.

Example:
ttk::style configure Treeview.Row -background color
-foreground
Configures the foreground color used to draw items in the tree column (#0) when applied to an .Item style sub-selector.

Configures the foreground color used to draw items in the tree column (#0) when applied to an .Item style sub-selector.

Configures the foreground color used to draw non-tree (-values list) columns when applied to a .Cell style sub-selector.

Examples:
ttk::style configure Treeview.Item -foreground color
ttk::style configure Treeview.Cell -foreground color
-rowheight
Adjusts the rowheight (spacing between rows) in the treeview, distance is in pixels.

Example:
ttk::style configure Treeview -rowheight height
-indent
Adjusts the indentation amount of child elements below parent elements within the tree column.

Example:
ttk::style configure Treeview -indent distance

Adjustment of the background color of selected items in the treeview uses the ttk::style map sub-command applied to the style sub-selectors above:

ttk::style map Treeview.Row  -background [ list selected color ]
ttk::style map Treeview.Cell -background [ list selected color ]
ttk::style map Treeview.Item -background [ list selected color ]

Adjustment of the background color of the the column heading labels uses the ttk::style map sub-commend applied to the .Heading style sub-selector:

ttk::style map Treeview.Heading -background [ list active  color !active color ]