Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text_config for DecimalNumber #1744

Merged
merged 4 commits into from Feb 15, 2022
Merged

Add text_config for DecimalNumber #1744

merged 4 commits into from Feb 15, 2022

Conversation

TurkeyBilly
Copy link
Contributor

Added config passing for text

Motivation

Give users option to change the text config for DecimalNumber

Proposed changes

  • Added text_config in decimal number config
  • Removed extra init_colors() so that t2c can be passed in
  • Adjustedstring_to_mob method so key word arguments can be accepted, meanwhile maintain the string_to_mob_map

Test

Code:

class Test(Scene):
    def construct(self):
        a = DecimalNumber(1.02, show_ellipsis=True)
        b = DecimalNumber(1.02, show_ellipsis=True, 
                            text_config=dict(font="仿宋", slant=ITALIC)).shift(DOWN)
        c = DecimalNumber(1.02, show_ellipsis=True, 
                            text_config=dict(font="Times New Romen", t2c={'0':RED})).shift(2*DOWN)
        self.add(a, b, c)

Result:
image

manimlib/mobject/numbers.py Outdated Show resolved Hide resolved
@3b1b 3b1b merged commit a4eee6f into 3b1b:master Feb 15, 2022
TonyCrane added a commit that referenced this pull request Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants