Skip to content

Conversation

irvanalhaq9
Copy link
Contributor

@irvanalhaq9 irvanalhaq9 commented May 13, 2025

Overview: What does this pull request change?

Fix #4244

Motivation and Explanation: Why and how do your changes improve the library?

Calling get_number_mobjects() in NumberLine without any arguments caused error.
This PR resolves this issue (see: #4244).

Changes

  • Introduced method get_numbers_to_display():
    • Extracted from the logic previously embedded in add_numbers().
  • Updated get_number_mobjects():
    • Uses get_numbers_to_display() when numbers is not provided.
  • Simplified add_numbers():
    • Moved the logic for determining which numbers to include and which numbers to exclude to the get_numbers_to_display() method. This allows add_number() to focus only on adding the number objects to the axis.
    • Delegates label creation to get_number_mobjects().
    • Removed redundant checks of font_size and label_constructor, as these are already handled inside get_number_mobject().

Links to added or changed documentation pages

No changes in the documentation: https://manimce--4248.org.readthedocs.build/en/4248/reference/manim.mobject.graphing.number_line.NumberLine.html#manim.mobject.graphing.number_line.NumberLine

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

AttributeError: NumberLine object has no attribute 'default_numbers_to_display' when calling get_number_mobjects()
1 participant