Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add option progress_bar on/off

azarzadavilaeee98747408f
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index a9278cebb..0e195fc9d 100644
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -680,7 +680,7 @@ class Scene(Container):
else:
step = 1 / self.camera.frame_rate
times = np.arange(0, run_time, step)
- disable = file_writer_config["verbose"] not in ["DEBUG", "INFO"]
+ disable = not file_writer_config["progress_bar"]
time_progression = ProgressDisplay(
times, total=n_iterations,
leave=file_writer_config['leave_progress_bars'],
diff --git a/manim/utils/config_utils.py b/manim/utils/config_utils.py
index ee43a0e62..4791ac821 100644
--- a/manim/utils/config_utils.py
+++ b/manim/utils/config_utils.py
@@ -133,6 +133,16 @@ def _parse_file_writer_config(config_parser, args):
if ffmpeg is None and default.getint("ffmpeg", None) is not None:
ffmpeg = default.getint("ffmpeg")
fw_config["ffmpeg"] = constants.VERBOSE_FFMPEG_MAP[verbose] if ffmpeg is None else ffmpeg
+ if verbose in ["DEBUG", "INFO"]:
+ progress_bar_v = True
+ else:
+ progress_bar_v = False
+ progress_bar = getattr(args, "progress_bar")
+ if progress_bar is None:
+ progress_bar = default.get("progress_bar", None)
+ if progress_bar is not None:
+ progress_bar = True if progress_bar == "on" else False
+ fw_config["progress_bar"] = progress_bar_v if progress_bar is None else progress_bar
return fw_config
@@ -341,6 +351,13 @@ def _parse_cli(arg_list, input=True):
metavar="loglevel",
choices=[-8, 0, 8, 16, 24, 32, 40, 48, 56],
)
+ parser.add_argument(
+ "--progress_bar",
+ type=str,
+ help="Display the progress bar",
+ metavar="on/off",
+ choices=["on", "off"],
+ )
return parser.parse_args(arg_list)