S or /

SourceClass NumberFormatter

from egui import NumberFormatter
class NumberFormatter:

How to format numbers in e.g. a egui.DragValue.

Methods§

@staticmethod def default() -> NumberFormatter§
Sourcedef format(self, /, value: float, min_decimals: int, max_decimals: int) -> str§

Format the given number with the given number of decimals.

Decimals are counted after the decimal point.

The minimum number of decimals is usually automatically calculated from the sensitivity of the egui.DragValue and will usually be respected (e.g. include trailing zeroes), but if the given value requires more decimals to represent accurately, more decimals will be shown, up to the given max.