Scale#

Scale is the native ttk slider for choosing a numeric value from a range (ttk.Scale), themed by ttkbootstrap. This page is the complete reference for its options, methods, and styling.

Options#

Each option can be set in the constructor and changed later with configure().

Option

Type

Description

bootstyle

str

Constructor keyword. An accent color, optionally with a variant. See Styling options for the available styles.

from_

float

The value at one end of the scale’s range.

to

float

The value at the other end of the scale’s range.

value

float

The current value.

variable

Variable

A DoubleVar (or IntVar) bound to the current value.

orient

str

The layout direction: "horizontal" or "vertical".

length

int

The slider’s length in pixels.

command

callable

Called with the new value (as a string) whenever the slider moves.

state

str

"normal" or "disabled".

cursor

str

The mouse cursor over the scale (see Cursors).

takefocus

bool

Whether the scale accepts keyboard focus during traversal.

Methods#

get(x=None, y=None)

Return the current value, or the value at a pixel coordinate.

Return type:

float

set(value)

Set the value.

Returns:

None.

coords(value=None)

Return the pixel coordinates of the slider for value (default: the current value).

Return type:

tuple

Styling options#

This section is for changing how the scale looks. Define a style with style.configure(...) (and style.map(...) for per-state colors), then apply it with Scale(style=...).

Bootstyle mapping#

Any of the accent colors – primary, secondary, success, info, warning, danger, light, dark – substitutes for primary below. neutral does not apply to this family.

A vertical widget resolves to the Vertical. twin of each style name above.

bootstyle

ttk style name

primary

primary.Horizontal.TScale

Layout (elements)#

The widget is drawn from these nested parts. Each is an element you can target by name in a custom layout:

primary.Horizontal.Scale.focus
  primary.Horizontal.Scale.track
  primary.Horizontal.Scale.slider

Configurable style options#

Note

The trough and slider are drawn from a pre-rendered image keyed to the bootstyle color; style.configure(...) does not reach them. The options listed here style only the widget’s non-image parts (such as the focus ring). To recolor the trough and slider, choose a bootstyle color; to change their shape or artwork, build a custom image-based layout – see Custom styles.

Options you can set with style.configure(...) / style.map(...):

focuscolor, focussolid, focusthickness

Supported states#

This style declares no style.map(...) overrides; any state-dependent appearance is drawn from its image elements.

Hand-styling example#

import ttkbootstrap as ttk

app = ttk.App()
style = app.style

style.configure("my.Horizontal.TScale", background="#3498db", foreground="white")
ttk.Scale(app, style="my.Horizontal.TScale").pack(padx=8, pady=8)

app.mainloop()

Shared capabilities#

Scale also has the methods every widget inherits — configuration, placement, event binding, lifecycle, focus, and introspection — plus the ttk state methods state / instate / identify. These are documented under Capabilities.

See also#