dash-core-components
dash-core-components copied to clipboard
feature suggestion: Slider should have value printed next to it
the Slider should have an option to display the current value like ipywidgets sliders.
You can do this yourself with a label and a callback if required. Agreed it would be nice to see integrated though.
true. having a callback for every slider seems highly redundant.
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
i thought the app.callback had to be present to run the app, meaning not generated dynamically with a function?
Ideally, yes. But generating a callback within another function is fine and can still be done on the initial load / to create the initial layout (so it’s not dynamic in this sense).
But actual dynamic callbacks are also possible I believe, if you “suppress_callback_exceptions” in your app config.
On Fri, Aug 10, 2018 at 04:44, alex arsenovic [email protected] wrote:
i thought the app.callback had to be present to run the app, meaning not generated dynamically with a function?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plotly/dash-core-components/issues/255#issuecomment-412058771, or mute the thread https://github.com/notifications/unsubscribe-auth/AC1rRA7x71eaRlcu-Yui6NlGcGfo7GAsks5uPXIxgaJpZM4VyWcJ .
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']
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"})