-
-
Notifications
You must be signed in to change notification settings - Fork 525
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 Widget.from_param classmethod #1344
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1344 +/- ##
==========================================
+ Coverage 87.49% 87.69% +0.19%
==========================================
Files 130 130
Lines 13758 13976 +218
==========================================
+ Hits 12038 12256 +218
Misses 1720 1720
Continue to review full report at Codecov.
|
I got as far as the title on this page before my brain went (a) nice! and (b) can we have a shorter name? :-) How about just |
I don't remember if I ever brought this up but I'll still give you my 2 cents! This pn.widgets.FloatSlider.from_parameter(a.param.value, start=0, end=3.14) is better than pn.Param(a.param.value, widgets={"value": {"type": pn.widgets.FloatSlider, "start":0, "end":3.14}}) That's even better :-) pn.widgets.FloatSlider.from(a.param.value, start=0, end=3.14) As for the implementation, is it intended that it returns a |
No, I think it should return the widget as you point out. |
Oh and |
Arf missed that. I like that the method starts with |
Yeah, I'm also leaning towards |
* Add Widget.from_parameter classmethod * Renamed to from_param * Add docs * Add tests
Simplifies the creation of a widget linked to and created from a particular parameter.
@maximlt @MarcSkovMadsen Any thoughts on this? It's a solution to something I think you both brought up before. If you like the idea maybe we should also consider a shorter method name than
from_parameter
, suggestions welcome.