Panel interact with throttled values


I was wondering if there were a build-in way to use pn.interact with a widgets value_throttled (if it the widget type has it) instead of value. Right now i´m using my own function, which works for most cases.

def interact_throttled(func, **kwargs):
    widgets = pn.interact(lambda **kwargs: None, **kwargs)[0]
    kwargs_throttled = {}
    for k, w in zip(kwargs, widgets):
        if isinstance(w, pn.widgets.DiscreteSlider):
            kwargs_throttled[k] = w.param.value

        elif hasattr(w, "value_throttled"):
            if w.value_throttled is None:
                w.value_throttled = w.value
                w.value = w.value_throttled

            kwargs_throttled[k] = w.param.value_throttled

            kwargs_throttled[k] = w.param.value

    return pn.Column(widgets, pn.depends(**kwargs_throttled)(func))

Only way to do this right now is to provide explicit widget instances to pn.interact. I’d be happy to entertain a feature request that lets you toggle it though.

I’m looking at it right now. When you say toggle it through, do you mean e.g. pn.interact(func, x=x, throttled=True) or a seperate function like pn.interact_throttle(func, x=x).

I will properly need some help with how to do a feature request, because I have very little experience with Github.

Both are options and we can discuss on the issue. Just go here click on Feature request and then describe the problem and the two solutions you just suggested.

I have done this in

If I have a working code example of the feature request, what is the best practice to share/show it in the feature request?

Just paste the code you used to achieve it.