-
-
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
Make editable sliders name parameter editable (from python) #2663
Comments
Hi @TheoMathurin. Could you provide a small, reproducible code example? That would make it easier to reproduce, explore, fix and release. Thanks. And for me to probably show you a temporary workaround :-) |
Sure import panel.widgets as pnw
slider = pnw.EditableFloatSlider(name='name1')
slider.param.set_param(name='name2') Thanks in advance |
I tried to find a workaround but it errors import param
import panel.widgets as pnw
import panel as pn
pn.extension()
slider = pnw.EditableFloatSlider(name='name1')
with param.edit_constant(slider):
slider.name='name3'
slider TypeError: Constant parameter 'name' cannot be modified |
That is the same error you get when trying to modify it directly. |
The work around is : |
It works, thanks @xavArtley! |
try:
slider.name = "name3"
except TypeError:
pass also works. This is because the name of the widget is actually being correctly set in the first place (under the hood the value of a |
Editable sliders are a very nice addition to panel components and can advantageously replace conventional sliders in most cases in my opinion. However there is a difference currently with respect to the name parameter, which is constant in editable sliders while it is not in conventional sliders.
As in my app I use sliders which have their name changed programmatically, I would like to know if editable sliders could be modified so that the name parameter is no longer constant? In general I think it's best to make editable sliders behave identically to their non-editable counterparts as far as practicable.
The text was updated successfully, but these errors were encountered: