S or /

SourceClass DragValue

from egui import DragValue
class DragValue:

A numeric value that you can change by dragging the number. More compact than a egui.Slider.

Methods§

Sourcedef binary(self, /, min_width: int, twos_complement: bool) -> DragValue§

Display and parse the number as a binary integer. See ValueFormat.binary.

Sourcedef clamp_existing_to_range(self, /, clamp_existing_to_range: bool) -> DragValue§

If set to True, existing values will be clamped to egui.DragValue.range.

If False, only values entered by the user (via dragging or text editing) will be clamped to the range.

Without calling range

With .clamp_existing_to_range(True) (default)

With .clamp_existing_to_range(False)

def clamp_range(self, /, min: float, max: float) -> DragValue§
def clamp_to_range(self, /, clamp_to_range: bool) -> DragValue§
Sourcedef custom_formatter(self, /, formatter: Any) -> DragValue§

Set custom formatter defining how numbers are converted into text.

A custom formatter takes a float for the numeric value and a RangeInclusive<int> representing the decimal range i.e. minimum and maximum number of decimal places shown.

The default formatter is egui.Style.number_formatter.

See also: DragValue.custom_parser

Sourcedef custom_parser(self, /, parser: Any) -> DragValue§

Set custom parser defining how the text input is parsed into a number.

A custom parser takes an str to parse into a number and returns a float if it was successfully parsed or None otherwise.

See also: DragValue.custom_formatter

Sourcedef fixed_decimals(self, /, num_decimals: int) -> DragValue§

Set an exact number of decimals to display. Values will also be rounded to this number of decimals. Normally you don't need to pick a precision, as the slider will intelligently pick a precision for you. Regardless of precision the slider will use "smart aim" to help the user select nice, round values.

Source@staticmethod def from_get_set(get_set_value: Any) -> DragValue§

Creates a drag value over a value that cannot be borrowed directly.

The closure is called with None to read the value and with Some(new_value) to write it, and returns the value either way.

Sourcedef hexadecimal(self, /, min_width: int, twos_complement: bool, upper: bool) -> DragValue§

Display and parse the number as a hexadecimal integer. See ValueFormat.hexadecimal.

Sourcedef max_decimals(self, /, max_decimals: int) -> DragValue§

Set a maximum number of decimals to display. Values will also be rounded to this number of decimals. Normally you don't need to pick a precision, as the slider will intelligently pick a precision for you. Regardless of precision the slider will use "smart aim" to help the user select nice, round values.

Sourcedef max_decimals_opt(self, /, max_decimals: int |None) -> DragValue§

Set the maximum number of decimals to display, or None to let the widget pick.

Values will also be rounded to this number of decimals when it is set.

Sourcedef min_decimals(self, /, min_decimals: int) -> DragValue§

Set a minimum number of decimals to display. Normally you don't need to pick a precision, as the slider will intelligently pick a precision for you. Regardless of precision the slider will use "smart aim" to help the user select nice, round values.

Sourcedef octal(self, /, min_width: int, twos_complement: bool) -> DragValue§

Display and parse the number as an octal integer. See ValueFormat.octal.

Sourcedef prefix(self, /, prefix: str) -> DragValue§

Show a prefix before the number, e.g. "x: ".

Goes in front of any prefix already set, so .prefix("b").prefix("a") shows ab.

Sourcedef range(self, /, min: float, max: float) -> DragValue§

Sets valid range for dragging the value.

By default all values are clamped to this range, even when not interacted with. You can change this behavior by passing False to egui.DragValue.clamp_existing_to_range.

def show(self, /, ui: Ui) -> Response§
Sourcedef speed(self, /, speed: float) -> DragValue§

How much the value changes when dragged one point (logical pixel).

Should be finite and greater than zero.

Sourcedef suffix(self, /, suffix: str) -> DragValue§

Add a suffix to the number, this can be e.g. a unit ("°" or " m").

Goes after any suffix already set, so .suffix("a").suffix("b") shows ab.

Sourcedef update_while_editing(self, /, update: bool) -> DragValue§

Update the value on each key press when text-editing the value.

Default: True. If False, the value will only be updated when user presses enter or deselects the value.