How to best display float/int/string data that is by nature read only (values read out from peripherals)

Hi,

I have i.e. a pump that I can control in a panel dashboard. When it moves, I read out its plunger position. This is a read only value that I want to display in the dashboard. If I set read only, it cannot be set from code. If I use edit_constant, the code gets messy and the GUI flickers (the change between constant and editable)
I guess the pn.indicators.Number could work, but it doesn’t fit my needs without much modification.
Should there not be a flag to a widget, telling it to be only writable from code, or maybe more indicators?

Thanks!

Can you clarify what’s lacking from pn.indicators.Number for your use case?

I realized I can change font sizes globally, and then it does the job:

pn.indicators.Number.font_size = ‘12pt’
pn.indicators.Number.title_size = ‘10pt’

First I envisioned a greyed out FloatInput without up/down arrows, but Number with smaller font should work.

Thank you

Can I control nr of decimals with the format string?

I think the format is just a format string, so it should be possible with something like this:

import panel as pn
pn.extension()
pn.indicators.Number(value=10000, format='${value:,.2f}')

image

2 Likes