tryst-value-slider
Version, currently main branch2 versions
- 0.1.0latestSep 1, 2026
- main branchAug 28, 2026
github.com/jamescook/tryst-value-slider
A single-thumb value slider for tryst - rounded track, antialiased thumb, optional tick marks, and a value bubble that tracks the thumb while dragging. Built on Tryst::OwnerDrawnWidget and rendered through tryst-vector.
Installation
# Add this to your shard.yml
dependencies:
tryst-value-slider:
github: jamescook/tryst-value-slider
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.21.0- License
- MIT
- Author
- James Cook
Dependencies
Runtime Dependencies
- tryst*github: jamescook/tryst
- tryst-vector*github: jamescook/tryst-vector
Development Dependencies
- ameba*github: crystal-ameba/ameba, tag: v1.7.0dev
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
tryst-value-slider
A single-thumb value slider for tryst, Crystal's Tcl/Tk binding —
a rounded track with a filled portion, an antialiased thumb, optional
tick marks with min/max labels, and a value bubble that tracks the
thumb while dragging or keyboard-adjusting. Built on
Tryst::OwnerDrawnWidget and rendered through tryst-vector.
require "tryst"
require "tryst-value-slider"
app = Tryst::App.new
slider = Tryst::ValueSlider.new(app, min: 0.0, max: 100.0, step: 1.0, value: 65.0, ticks: 5)
slider.pack(fill: "x", padx: 16, pady: 8)
slider.on_change { |v| puts "volume now #{v.round.to_i}%" }
app.show
app.mainloop

From examples/value_slider_demo.cr.
It's just a widget: #pack/#grid place it, #value/#value= read
and set it, #on_change fires on every user-driven change (drag,
click-to-position, or keyboard) but never for a programmatic #value=
— the same split every other stateful widget in this codebase draws.
Nothing about it being canvas-backed or ThorVG-rendered is part of its
own public surface. format: (a Proc(Float64, String)) controls the
bubble's text; accent: overrides the theme-derived default with a
#rrggbb hex string. See examples/value_slider_demo.cr for a runnable
version with ticks, a custom format, and a disabled slider side by side.
The bubble is a fixed size, not shrink-to-fit around whatever the
current value renders as — sizing it to the live text made the whole
bubble visibly wobble while dragging the moment the string length
itself changed (e.g. "1.0" vs "1.25"). By default the width is
max(format(min), format(max)), measured once at construction;
bubble_width: (pixels) overrides that guess outright, for a custom
format: whose widest output isn't at either end of the range.
font: defaults to "TkTextFont" (Tk's own named font, resolving to
whatever system UI face each platform uses) and applies to all three
labels (min, max, bubble) — pass any real Tk font spec (another named
font, or a literal "family size" string) to override it.
The default accent color comes from Tryst::Theme#accent (the active
ttk theme's own -selectbackground), so it already matches
aqua/clam/vista rather than a hardcoded color.
Requirements
Whatever tryst and tryst-vector need - Crystal >= 1.21.0, Tcl/Tk 8.6, and ThorVG >= 1.0 (see tryst-vector's own README for per-platform package names and why).
Examples
crystal run examples/value_slider_demo.cr
Tests
shards install
crystal spec # host
scripts/docker-test.sh # Debian forky, same suite
scripts/docker-test.sh builds from this repo's own root; shards install inside the image fetches tryst and tryst-vector directly via
their github: dependencies. It takes the same arguments crystal spec does, so a focused run works there too.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Aug 28, 2026
- Crystal
>= 1.21.0- Indexed
- yes
Dependents
Repository
github.com/jamescook/tryst-value-slider
Metadata
- Created
- Aug 29, 2026
- Updated
- Sep 23, 2026
- Synced
- Sep 22, 2026
- Versions
- 2