-
-
Notifications
You must be signed in to change notification settings - Fork 508
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 a throttled argument to depends, interact and bind #1754
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1754 +/- ##
==========================================
+ Coverage 84.93% 85.12% +0.19%
==========================================
Files 151 151
Lines 17420 17941 +521
==========================================
+ Hits 14796 15273 +477
- Misses 2624 2668 +44
Continue to review full report at Codecov.
|
I'm a -1 on the changes to bind and depends since you can very easily use |
So what I'd like to see here is removing it from the depends/bind code, adding an example to the |
Also happy to see an example showing depends/bind usage with |
Thanks for the comments, I will do what you have suggested later this week. I would just like to mention that I have had a lot of problem finding out the correct way to apply |
@hoxbro. Why do you use |
Value throttle is updated only when you end interaction with the widget.
For exemple slider send value_throttle only when you release mouse button.
It avoid to call too often some functions wich can be time consuming
Le ven. 13 nov. 2020 à 11:51, Marc Skov Madsen <notifications@github.com> a
écrit :
… @hoxbro <https://github.com/Hoxbro>. Why do you use value_throtled at all
and what does it do? (I've never used that.)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1754 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AENMGS72JDWYBUY6GITHFWLSPUFRPANCNFSM4TPYFYSQ>
.
|
As @xavArtley explained it is for calling a function after the mouse is released from the slider and not continually doing the sliding. When the function takes a long time to calculate it becomes very frustrating because it feels like it takes even longer than it should, see example below. Also if the function has to open a file or look up values from a database it will do it a unnecessary amount of times. import panel as pn
import time
pn.extension()
def func(x):
time.sleep(1)
return repr(x)
widget1 = pn.widgets.IntSlider(start=1, end=100)
widget2 = pn.widgets.IntSlider(start=1, end=100)
slider1 = pn.bind(func, widget1)
slider2 = pn.bind(func, widget2.param.value_throttled)
pn.Column(widget1, slider1, widget2, slider2).servable() Right now the only options is to add the Another problem with |
Thanks so much! I'll merge this for now, and further improvements for the docs can come later. |
The Parameterized class problem is a good point, I think we should allow configuring that in the Param pane |
Supersede #1400
The goal of this PR is to discuss the option to add a argument to
pn.depends
,pn.interact
andpn.bind
which throttles the slider widgets as mention in #1259.This is a work in progress and await input from @philippjfr.
For testing purpose I use this script:
Missing tasks:
throttled
.