Extract the value from an ipywidget

Hi all! I want to extract the value from an ipywidget but the values between the Solara app and the ipywidget do not coincide (I need to keep pressing the slider for a long time before they both agree). Here is the code I have:
import solara
import ipywidgets as widgets

aux = solara.reactive(0)
@solara.component
def Page():
    slider = widgets.IntSlider()
    output = widgets.Output()
    display(slider, output)
    def on_value_change(change):
        with output:
            aux.value = change["new"]
    slider.observe(on_value_change, names='value')
    solara.Markdown(f"{aux.value}")

Or you can check it here: https://app.py.cafe/snippet/solara/v1?c=H4sIAEmrJ2YAA11RTUvEMBD9KyGX7UIpngsLXjx4EAXBi5FltpnuBtNJTNKtZfG_O21TKc4lycub9-bjJhunUdbSdN6FJKKzEEBRfho_DkafMUUBUeSrIkXQf4tDZlcBoUnmisXdXtF9BhvHEoSUFGlsxQucsdjXigRHtEZjYIGsWD1Sep2xghUmhuuT79OG8TwD67c20VsYi0WozPT1k-0cHa9gezw2FyB2Xo7Vf4rBpEvO26BTcG_VnMz2S967koSDkh_b8it3ihi4639epSDoMB52M7jLReWpPEH41G6golXy9mf0oyTTZCkDfvUmYMdji7yUGUujnxa0CPAbvH8zOMi6BRuxlKhNeiA4WWalwGK_NO9QjNQBAAA
I know I could do it with the solara.SliderInt() component or through an ipywidget application but I want to see if we can do it without those solutions...
Was this page helpful?