ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

interact: add slider init-value support when passing a tuple

Open YongcaiHuang opened this issue 10 months ago • 0 comments

current interaction can pass a tuple (min, max, step), but without init-value can be set. The current solution is only to create an instance of FloatSlider/IntSlider with value passed, but it requires more codes.

@interact(val=(0, 100, 5))
def example(val):
    print(f"{val:.2f}")

ideal

@interact(val=(0, 100, 5, 20)) # one more value to set init value
def example(val):
    print(f"{val:.2f}")

YongcaiHuang avatar Apr 07 '24 04:04 YongcaiHuang