-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix: Fixed a bug in regards to empty inputs in AddTextLetterByLetter class. #3404
Changes from 10 commits
b9d2377
73b6d07
cdd4903
b89ffcc
37698f0
e3f95db
db1fc4f
d3f0a10
d1cc590
2b8bf5b
42b2cb8
1159f65
72256fd
0c7ee00
9d69ce2
0b442a2
b638927
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -563,15 +563,22 @@ def __init__( | |
**kwargs, | ||
) -> None: | ||
self.time_per_char = time_per_char | ||
|
||
# Check for empty text using family_members_with_points() | ||
if not text.family_members_with_points(): | ||
raise ValueError( | ||
"The input text is empty i.e., input has no characters to read thus cannot render a video file." | ||
) | ||
|
||
if run_time is None: | ||
# minimum time per character is 1/frame_rate, otherwise | ||
# the animation does not finish. | ||
Immanuel-Alvaro-Bhirawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run_time = np.max((1 / config.frame_rate, self.time_per_char)) * len(text) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for adding this newline? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No reason at all! |
||
super().__init__( | ||
text, | ||
suspend_mobject_updating=suspend_mobject_updating, | ||
int_func=int_func, | ||
rate_func=rate_func, | ||
time_per_char=time_per_char, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parent class, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood got it! |
||
run_time=run_time, | ||
reverse_rate_function=reverse_rate_function, | ||
introducer=introducer, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'd prefer a shorter error message (e.g.,
f"The text mobject {text} does not seem to contain any characters."
) and remove the comment about the video file (which is a consequence the user does not strictly need to know about).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay got it Ben!