widgetti / widgetti/ipyvuetify

Play (Animation) Widgets jslink not triggering the event

Open
#226 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
355
Forks
61
PR merge metrics
No merged PRs in 30d

Description

The Play widget event (and jslink binding) is working fine on IPYWidget's IntSlider. However, not working on Vue Slider. The manual mouse click event captures both Slider widgets. Am I missing anything?

import ipyvuetify as vue
import ipywidgets as widgets
from ipychart import Chart

import numpy as np

slider_type = 0  # IPYWidgets IntSlider
# slider_type = 1  # IPYVuetify Slider

def on_value_change(change, *args):
    cht.data = {
        "labels": [
            "One",
            "Two",
            "Three",
            "Four",
        ],
        "datasets": [{"data": np.random.random(4), "lineTension": 0.3}],
    }

cht = Chart(
    kind="line",
    data={
        "labels": [
            "One",
            "Two",
            "Three",
            "Four",
        ],
        "datasets": [{"data": np.random.random(4), "lineTension": 0.3}],
    },
)

play = widgets.Play(min=1, max=10, interval=1000)

if slider_type == 0:
    # IPYWidgets IntSlider
    slider = widgets.IntSlider(min=2, max=10, step=1, continuous_update=True)
    slider.observe(on_value_change, "value")
    widgets.jslink((play, "value"), (slider, "value"))
else:
    # IPYVuetify Slider
    slider = vue.Slider(
        v_model="value",
        thumb_label="always",
        min=2,
        max=10,
        step="1",
        label="Test",
        class_='ma-5, pa-5'
    )
    slider.on_event("change", on_value_change)
    widgets.jslink((play, "value"), (slider, "v_model"))

widgets.VBox([play, slider, widgets.VBox([cht])])

Contributor guide

No contributing guide indexed for this repository

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 with the provided reproduction and compare the working ipywidgets IntSlider path with ipyvuetify's Slider event and v_model handling. Trace how jslink updates the Slider and how its change callback is registered; done means the linked Play widget updates the Slider and triggers the expected callback as the IntSlider does.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
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.