Advice on using Panel/Params with the Python Pint library (for physical quantities)

I use the python pint library to model problems with physical quantities and units e.g. width = 10cm.

I would like to create a custom parameter for a quantity with physical units and then render a helpful widget for this parameter in panel – I was hoping to get high level advice about how to proceed (and, in exchange I will report the details once I am done)

u = pint.UnitRegistry()
class Foo  (Parameterized):
    width = PhysicalQuantity(10*, bounds = (1*, 50*

bar = Foo()

# Uses maybe one compound widget three sub-widgets: a slider, a dropdown for prefix (k, m, c, u), and length unit (meter, foot, inch, etc) 

More generally, I think I can figure out how to add a Parameter class for a custom type. Curious how to register w/ Panel which widget I would like to use for that parameter class. Also, how to combine multiple widgets into one widget.


1 Like

There was some discussions in this thread