matplotlib / matplotlib/matplotlib

Use `widgets.TextBox` as text readout for sliders

Open
#19,257 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep New feature topic: widgets/UI
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

### Problem
When using a slider there it is not easy to select a precise value when using the mouse. You can do this with `slider.set_val` but this is not always convenient.

### Proposed Solution

Use `widgets.TextBox` to display the slider readout. Then hook it up so that a user can enter values into the textbox and on submit the slider value will change.

To do this fully properly I think two additional things would need to happen:
1. Implement numeric only TextBox
2. if user clicks off of TextBox after typing then return the textbox to the current value of the slider.

### Additional context and prior art
Inspired by examples here: https://www.smashingmagazine.com/2017/07/designing-perfect-slider/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing slider and widgets.TextBox APIs, including slider.set_val, to understand how values and submissions are handled. Done means the slider displays its value in a TextBox, accepts submitted values, supports numeric-only input, and restores the current slider value when focus is lost after editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.