Formatting of Number to show more digits, something like %f6.3

I have a param.Number declared and need to have it shown with 3 digits in the corresponding UI element (the automatically generated one).

Is there an option in the param.Number declaration to allow me to specify this? (similar to yformatter in holoviews/panel).

Is there a way with autocomplete or other so that I can find this myself instead of asking here?

Hi @piet8stevens,

Which widget do you automatically get? With a param.Number I believe you could either get a FloatSlider or a Spinner. Both widgets have a step option you could set to 0.001. It will be automatically set if you set the step option of param.Number. The FloatSlider has a format option for more advanced formatting (e.g. 29.99€).

Note that param is a library that allows to define a class whose attributes are automatically validated (type, bounds, etc.), among other things. It has got nothing to do with any GUI, you could just use it on its own to develop your own library/app. However when you declare a Parameterized class it’s expressive enough so that panel can extract information for each parameter and display them as widgets. label and precedence are the two parameter options that seem to be the most GUI-oriented (precedence particularly), but that’s it. There are ways though given by Panel to customize the widget automatically displayed, for instance you can write something like pn.Param(yourclass.param, widgets={"a_param"={"type":pn.widgets.FloatSlider, "format":"1[.]00"}}).

As for where to look for information, I often use the search bar on https://panel.holoviz.org/index.html and find it useful. The Reference Gallery is a very good source of information.

Cheers!

1 Like