mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
merge
This commit is contained in:
commit
2a3db89a2d
3 changed files with 11 additions and 9 deletions
|
@ -26,18 +26,20 @@ def is_child_scene(obj, module):
|
||||||
|
|
||||||
def prompt_user_for_choice(scene_classes):
|
def prompt_user_for_choice(scene_classes):
|
||||||
name_to_class = {}
|
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__
|
name = scene_class.__name__
|
||||||
print(name)
|
print(f"{str(idx).zfill(max_digits)}: {name}")
|
||||||
name_to_class[name] = scene_class
|
name_to_class[name] = scene_class
|
||||||
try:
|
try:
|
||||||
user_input = input(
|
user_input = input(
|
||||||
"\nThat module has multiple scenes, which "
|
"\nThat module has multiple scenes, "
|
||||||
"ones would you like to render?\n Scene Name: "
|
"which ones would you like to render?"
|
||||||
|
"\nScene Name or Number: "
|
||||||
)
|
)
|
||||||
return [
|
return [
|
||||||
name_to_class[user_input]
|
name_to_class[split_str] if not split_str.isnumeric() else scene_classes[int(split_str)-1]
|
||||||
for num_str in user_input.replace(" ", "").split(",")
|
for split_str in user_input.replace(" ", "").split(",")
|
||||||
]
|
]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logging.log(logging.ERROR, "Invalid scene")
|
logging.log(logging.ERROR, "Invalid scene")
|
||||||
|
|
|
@ -99,7 +99,7 @@ class NumberLine(Line):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_tick_marks(self):
|
def get_tick_marks(self):
|
||||||
return self.tick_marks
|
return self.ticks
|
||||||
|
|
||||||
def number_to_point(self, number):
|
def number_to_point(self, number):
|
||||||
alpha = float(number - self.x_min) / (self.x_max - self.x_min)
|
alpha = float(number - self.x_min) / (self.x_max - self.x_min)
|
||||||
|
|
|
@ -82,7 +82,7 @@ class GraphScene(Scene):
|
||||||
if len(self.x_labeled_nums) > 0:
|
if len(self.x_labeled_nums) > 0:
|
||||||
if self.exclude_zero_label:
|
if self.exclude_zero_label:
|
||||||
self.x_labeled_nums = [x for x in self.x_labeled_nums if x != 0]
|
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:
|
if self.x_axis_label:
|
||||||
x_label = TexText(self.x_axis_label)
|
x_label = TexText(self.x_axis_label)
|
||||||
x_label.next_to(
|
x_label.next_to(
|
||||||
|
@ -116,7 +116,7 @@ class GraphScene(Scene):
|
||||||
if len(self.y_labeled_nums) > 0:
|
if len(self.y_labeled_nums) > 0:
|
||||||
if self.exclude_zero_label:
|
if self.exclude_zero_label:
|
||||||
self.y_labeled_nums = [y for y in self.y_labeled_nums if y != 0]
|
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:
|
if self.y_axis_label:
|
||||||
y_label = TexText(self.y_axis_label)
|
y_label = TexText(self.y_axis_label)
|
||||||
y_label.next_to(
|
y_label.next_to(
|
||||||
|
|
Loading…
Add table
Reference in a new issue