Scrollbar#
Scrollbar is the native ttk scrollbar that drives another widget’s view
(ttk.Scrollbar), 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 |
|---|---|---|
|
|
Constructor keyword. An accent color, optionally with a variant. See Styling options for the available styles. |
|
|
The layout direction: |
|
|
The scrolled widget’s |
|
|
The mouse cursor over the scrollbar (see Cursors). |
|
|
Whether the scrollbar accepts keyboard focus during traversal. |
Methods#
- set(first, last)
Set the thumb to span the fractions
first..``last``; wired as the scrolled widget’sxscrollcommand/yscrollcommand.- Returns:
None.
- get()
Return the current
(first, last)fractions.- Return type:
- delta(deltax, deltay)
Return the fractional change a pixel movement of
(deltax, deltay)would cause.- Return type:
- fraction(x, y)
Return the fraction (0..1) corresponding to a pixel coordinate.
- Return type:
Styling options#
This section is for changing how the scrollbar looks. Define a style with
style.configure(...) (and style.map(...) for per-state colors), then
apply it with Scrollbar(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.
|
ttk style name |
|---|---|
|
|
|
|
|
|
Layout (elements)#
The widget is drawn from these nested parts. Each is an element you can target by name in a custom layout:
(no ttk layout introspected)
Configurable style options#
Note
The trough and thumb 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 thumb, 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(...):
(none)
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.TScrollbar", background="#3498db", foreground="white")
ttk.Scrollbar(app, style="my.TScrollbar").pack(padx=8, pady=8)
app.mainloop()
See also#
Scrollbar catalog page — usage, screenshots, and examples.
Tk ttk::scrollbar manual page — the canonical upstream reference (Tcl 8.6).