Parameterized class - Format numbers

I have a parameterized class with many parameters. Some of them are small float numbers. Once the class gets rendered, the slider will show approximation of the numbers, which is unfortunate because the same approximation is being used on several ticks of the slider. A small example:

import param
import panel as pn
pn.extension()

class Test(param.Parameterized):
    a = param.Number(default=0.035, softbounds=(-0.035, 0.035), step=1e-04)
    b = param.Number(default=3.5, softbounds=(-3.5, 3.5), step=1e-01)

pn.Row(Test().param)

Here, Iā€™d like the value of slider A to be formatted differently. How can I do that?

import param
import panel as pn
pn.extension()

class Test(param.Parameterized):
    a = param.Number(default=0.035, softbounds=(-0.035, 0.035), step=1e-04)
    b = param.Number(default=3.5, softbounds=(-3.5, 3.5), step=1e-01)

pn.Row(pn.Param(Test(), widgets={'a':{'format':'0.0000'},'b':{'format':'0.0'}}))
2 Likes