Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to toggle throttled on widgets with interact and depends #1259

Closed
hoxbro opened this issue Apr 11, 2020 · 4 comments
Closed

Add option to toggle throttled on widgets with interact and depends #1259

hoxbro opened this issue Apr 11, 2020 · 4 comments
Labels
type: enhancement Minor feature or improvement to an existing feature

Comments

@hoxbro
Copy link
Member

hoxbro commented Apr 11, 2020

Is your feature request related to a problem? Please describe.

I often want to use the value_throttled for my dashboard´s widgets and the only way to do it right now is the hard way by adding an explicit widget instance to pn.interact or pn.depends.

Describe the solution you'd like

Either add a keyword like throttled to pn.interact and pn.depends or create a new function which use the value_throttled if it exist for the widget e.g. pn.interact_throttled.

Additional context

Here are examples of pn.interact and pn.depends with a throttled keyword:
interact_example

ezgif com-video-to-gif

@hoxbro
Copy link
Member Author

hoxbro commented Apr 13, 2020

I have got an working example of the feature request mentioned above by adding the keyword throttled to the functions pn.interact and pn.depends. I have changed the files panel/interact.py and panel/depends.py to get this to work. I also needed to change panel/widgets/sliders.py so it solves the issues mentioned in #1253 and #1256. I have attached the files changed. Code used above:

import panel as pn
pn.extension()

func = lambda x: x
pn.interact(func, x=1, throttled=True)
import panel as pn
pn.extension()

int_range_slider = pn.widgets.IntRangeSlider(end=10, value=(2, 10), value_throttled=(7, 9))

@pn.depends(int_range_slider, throttled=True)
def print_slider_value(slider_value):
    return slider_value

pn.Column(int_range_slider, print_slider_value)

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Apr 14, 2020
@hoxbro
Copy link
Member Author

hoxbro commented May 6, 2020

Any updates on this enhancement?

@philippjfr
Copy link
Member

If there is any progress I'll record it here, if this is a priority for you I'd be happy to guide you through contributing a PR.

@hoxbro
Copy link
Member Author

hoxbro commented May 7, 2020

Awesome, I would definitely want your help in guiding me through it, so I do it the right way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants