I have a parametrized class and some of the parameters should never be changed by a user. They should be shown only. But the code should be able to update them.
How do I enable that?
Example
If the user clicks the below button the TypeError: Constant parameter 'mean_365d_30d_rolling' cannot be modified error is shown. How do I avoid that and allow the code to change the value?
import panel as pn
import param
def update(features):
features.mean_365d_30d_rolling += 1
class SpreadFeatures(param.Parameterized):
mean_365d_30d_rolling = param.Number(1.0, constant=True)
std_365_30d_rolling = param.Number(1.0)
action = param.Action(update)
features = SpreadFeatures()
pn.Param(features).servable()
I also got stumped by this. Would it not be nice with a setting for having a parameter writable from code but displayed as read only? Because this method gives a flickering effect as well.
I realize that my usecase is a little odd perhaps, but I want to display i.e. current position of a motor and have a field for setting target position beside it. In that case it would have been nice with something like pn.widgets.FloatDisplay or something. Have I missed something?