From 269128dfb64df9c29efbccbcb5779249ea3a56fb Mon Sep 17 00:00:00 2001 From: Tony031218 <975062472@qq.com> Date: Fri, 5 Feb 2021 13:57:00 +0800 Subject: [PATCH 1/3] fix NumberLine and GraphScene --- manimlib/mobject/number_line.py | 2 +- manimlib/scene/graph_scene.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manimlib/mobject/number_line.py b/manimlib/mobject/number_line.py index 1e50692e..8736ee6c 100644 --- a/manimlib/mobject/number_line.py +++ b/manimlib/mobject/number_line.py @@ -99,7 +99,7 @@ class NumberLine(Line): return result def get_tick_marks(self): - return self.tick_marks + return self.ticks def number_to_point(self, number): alpha = float(number - self.x_min) / (self.x_max - self.x_min) diff --git a/manimlib/scene/graph_scene.py b/manimlib/scene/graph_scene.py index 6bfc6d34..cc3faf78 100644 --- a/manimlib/scene/graph_scene.py +++ b/manimlib/scene/graph_scene.py @@ -82,7 +82,7 @@ class GraphScene(Scene): if len(self.x_labeled_nums) > 0: if self.exclude_zero_label: self.x_labeled_nums = [x for x in self.x_labeled_nums if x != 0] - x_axis.add_numbers(*self.x_labeled_nums) + x_axis.add_numbers(self.x_labeled_nums) if self.x_axis_label: x_label = TexText(self.x_axis_label) x_label.next_to( @@ -116,7 +116,7 @@ class GraphScene(Scene): if len(self.y_labeled_nums) > 0: if self.exclude_zero_label: self.y_labeled_nums = [y for y in self.y_labeled_nums if y != 0] - y_axis.add_numbers(*self.y_labeled_nums) + y_axis.add_numbers(self.y_labeled_nums) if self.y_axis_label: y_label = TexText(self.y_axis_label) y_label.next_to( From 390bfac9df6abd46638e77b4abe03e0e93f1a589 Mon Sep 17 00:00:00 2001 From: Sahil Makhijani Date: Fri, 5 Feb 2021 13:09:03 +0530 Subject: [PATCH 2/3] prompt_user_for_choice now prompts for Scene Name or Number --- manimlib/extract_scene.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/manimlib/extract_scene.py b/manimlib/extract_scene.py index d1467e44..1555f359 100644 --- a/manimlib/extract_scene.py +++ b/manimlib/extract_scene.py @@ -2,6 +2,8 @@ import inspect import sys import logging +from numpy.lib.shape_base import split + from manimlib.scene.scene import Scene from manimlib.config import get_custom_defaults @@ -26,18 +28,20 @@ def is_child_scene(obj, module): def prompt_user_for_choice(scene_classes): name_to_class = {} - for scene_class in scene_classes: + max_digits = len(str(len(scene_classes))) + for idx, scene_class in enumerate(scene_classes, start=1): name = scene_class.__name__ - print(name) + print(f"{str(idx).zfill(max_digits)}: {name}") name_to_class[name] = scene_class try: user_input = input( - "\nThat module has multiple scenes, which " - "ones would you like to render?\n Scene Name: " + "\nThat module has multiple scenes, " + "which ones would you like to render?" + "\nScene Name or Number: " ) return [ - name_to_class[user_input] - for num_str in user_input.replace(" ", "").split(",") + name_to_class[split_str] if not split_str.isnumeric() else scene_classes[int(split_str)-1] + for split_str in user_input.replace(" ", "").split(",") ] except KeyError: logging.log(logging.ERROR, "Invalid scene") From c0f6e94545b86f2fd24f2155288b7184bc53ea9b Mon Sep 17 00:00:00 2001 From: Sahil Makhijani Date: Fri, 5 Feb 2021 13:11:26 +0530 Subject: [PATCH 3/3] Removed unused import that was added by IDE autocomplete!! --- manimlib/extract_scene.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/manimlib/extract_scene.py b/manimlib/extract_scene.py index 1555f359..7a537769 100644 --- a/manimlib/extract_scene.py +++ b/manimlib/extract_scene.py @@ -2,8 +2,6 @@ import inspect import sys import logging -from numpy.lib.shape_base import split - from manimlib.scene.scene import Scene from manimlib.config import get_custom_defaults