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. This initial version is quite incomplete, as it only documents those bits I've deduced so far. This is for Tk 8.5.8.
dzach (2015-9-23) I changed the style to be similar to the tklib, added a few more ttk::style configuration options for Treeview and Treeview.Heading styles, which I have confirmed working with wish8.6. The mappings for Treeview.Heading are also confirmed to work. However, I have not been able to configure the style of some of the rest of the elements that appear on this page, namely Treeview.Row, Treeview.Item, Treeview.Cell and I have marked them with a (?). Maybe someone else can confirm those too, hopefully with an example on this page, and delete this part of the note.
bll 2015-10-21: See also: Changing Widget Colors
MAG 2019-08-28: See also: ttk::style toolbar
ttk::style configure Treeview.Heading ?options?
- -background color
- Configures the background color of the heading
- -font fontSpec
- Configures the font for the heading
- -foreground color
- Configures the foreground color of the heading
- -padding [list pixels ...]
- Additional padding to include inside the border of the heading
- -...
-
ttk::style configure Treeview ?options?
- -background color
- Configures the background color of rows that contain data values
- -fieldbackground color
- Configures the background color of the unused portion of a treeview widget (any area not covered by rows of data).
- -font fontSpec
- Configures the font for the contents of the tree (not the heading)
- -foreground color
- Configures the foreground for the contents of the tree
- -indent pixels
- Adjusts the indentation amount of child elements below parent elements within the tree column.
- -padding [list pixels ...]
- Additional padding to include inside the border of the widget body, including the heading
- -rowheight pixels
- Adjusts the rowheight (spacing between rows) in the treeview, distance is in pixels.
- -...
-
ttk::style configure Treeview.Row ?options?
- -background color
- Configures the background color of rows that contain data values when applied to a .Row style sub-selector. (?)
- -...
-
ttk::style configure Treeview.Item ?options?
- -foreground color
- Configures the foreground color used to draw items in the tree column (#0) when applied to an .Item style sub-selector. (?)
- -padding [list pixels ...]
- Additional padding to include inside the border of each tree item (column #), but not of the cells
- -...
-
ttk::style configure Treeview.Cell ?options?
- -foreground color
- Configures the foreground color used to draw non-tree (-values list) columns when applied to a .Cell style sub-selector. (?)
- -padding [list pixels ...]
- Additional padding to include inside the border of the cells (columns #1, #2, ...), but not of the tree items
- -...
-
ttk::style map Treeview.Heading ?options?
- -background [list active color !active color ...]
- Configures the background color of the heading for various states
- -...
-
ttk::style map Treeview.Row ?options?
ttk::style map Treeview.Cell ?options?
ttk::style map Treeview.Item ?options?
- -background [list active color !active color ...]
- Configures the background color of the elements for various states (?)
- -...
-
ttk::style configure TCheckbutton ?options?
- -wraplength distance
- Configures wordwrapping of the textual label of the checkbutton. Distance is in pixels.
- -...
-
ttk::style configure Vertical.Sash ?options?
ttk::style configure Horizontal.Sash ?options?
- -sashthickness pixels
- Configures the thickness of the sash between the panes of the paned window. Thickness is in pixels. Note that the vertical sash is used for the '-orient horizontal' layout of the panedwindow and vice versa. Also note that the sash seems not accessible anymore if the thickness is set to 1 (this is with Tk 8.6b3 on a Mac). It would also be great, if the color of the sash could be altered, but see also the section on "Create a custom sash handle bar" on this page: ttk::panedwindow.
- -...
-
ttk::style configure TNotebook ?options?
- -tabposition tabPosition
- Configure the position of the tabs. tabPosition can be any of n, s, e, w or meaningful combinations of them. nw is the default, sw configures the tabs at the bottom left, et.c.