manim.mobject.numbers.DecimalNumber

class DecimalNumber(number=0, num_decimal_places=2, include_sign=False, group_with_commas=True, digit_to_digit_buff=0.05, show_ellipsis=False, unit=None, include_background_rectangle=False, edge_to_fix=array([- 1., 0., 0.]), **kwargs)[source]

Bases: manim.mobject.types.vectorized_mobject.VMobject

An mobject representing a decimal number.

Examples

Example: MovingSquareWithUpdaters

from manim import *

class MovingSquareWithUpdaters(Scene):
    def construct(self):
        decimal = DecimalNumber(
            0,
            show_ellipsis=True,
            num_decimal_places=3,
            include_sign=True,
        )
        square = Square().to_edge(UP)

        decimal.add_updater(lambda d: d.next_to(square, RIGHT))
        decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
        self.add(square, decimal)
        self.play(
            square.animate.to_edge(DOWN),
            rate_func=there_and_back,
            run_time=5,
        )
        self.wait()

Methods

get_complex_formatter

get_formatter

Configuration is based first off instance attributes, but overwritten by any kew word argument.

get_value

increment_value

set_value

Attributes

animate

Used to animate the application of a method.

animation_overrides

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

get_formatter(**kwargs)[source]

Configuration is based first off instance attributes, but overwritten by any kew word argument. Relevant key words: - include_sign - group_with_commas - num_decimal_places - field_name (e.g. 0 or 0.real)