Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

feature suggestion: Slider should have value printed next to it #255

Open
arsenovic opened this issue Aug 7, 2018 · 7 comments
Open

feature suggestion: Slider should have value printed next to it #255

arsenovic opened this issue Aug 7, 2018 · 7 comments

Comments

@arsenovic
Copy link

the Slider should have an option to display the current value like ipywidgets sliders.

@mkhorton
Copy link

mkhorton commented Aug 8, 2018

You can do this yourself with a label and a callback if required. Agreed it would be nice to see integrated though.

@arsenovic
Copy link
Author

true. having a callback for every slider seems highly redundant.

@mkhorton
Copy link

mkhorton commented Aug 9, 2018

If you need it for every slider and plan to make a lot of them, you could write a function that creates the slider, slider label and callback all in one. So then you can just call your custom function to create the component group instead of dcc.Slider

@arsenovic
Copy link
Author

i thought the app.callback had to be present to run the app, meaning not generated dynamically with a function?

@mkhorton
Copy link

mkhorton commented Aug 10, 2018 via email

@radekwlsk
Copy link

radekwlsk commented Aug 13, 2018

But actual dynamic callbacks are also possible I believe, if you “suppress_callback_exceptions” in your app config.

@mkhorton Have you tested that?

@arsenovic Back to original question:
Creating helper functions for more complicated components is really working well. Just make function that returns dcc.Div with some more complicated children in it. For callbacks you can make it class rather than function and keep all id's in class level field. Then in place that you know is interpreted last you can create callbacks for all id's stored in that class:

>>> class MyClass:
...     i = []
...
>>> MyClass.i
[]
>>> MyClass.i += 'a'
>>> MyClass.i
['a']
>>> MyClass.i += 'b'
>>> MyClass.i
['a', 'b']

@almarklein
Copy link
Contributor

I think this is a duplicate of #324. The current status is that the value can be shown with a tooltip (see example below), and that there is a plan for a "slider companion".

slider = Slider(..., tooltip={"always_visible": False, "placement": "top"})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants