Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

make the -s flag invalidate -w

leotrsb3ebc9ec9c3e
diff --git a/manim/config.py b/manim/config.py
index 67927d28b..80def3829 100644
--- a/manim/config.py
+++ b/manim/config.py
@@ -118,6 +118,12 @@ def _parse_file_writer_config(config_parser, args):
attr = getattr(args, str_opt)
config[str_opt] = (default[str_opt] if attr is None else attr)
+ # Handle the -s (--save_last_frame) flag: invalidate the -w flag
+ # At this point the save_last_frame option has already been set by
+ # both CLI and the cfg file, so read the config dict directly
+ if config['save_last_frame']:
+ config['write_to_movie'] = False
+
# Handle the -t (--transparent) flag. This flag determines which
# section to use from the .cfg file.
section = config_parser['transparent'] if args.transparent else default
@@ -236,7 +242,7 @@ def _parse_cli(arg_list, input=True):
"-s", "--save_last_frame",
action="store_const",
const=True,
- help="Save the last frame",
+ help="Save the last frame (and do not save movie)",
)
parser.add_argument(
"-g", "--save_pngs",
diff --git a/manim/default.cfg b/manim/default.cfg
index c36991087..3ef6ae3b9 100644
--- a/manim/default.cfg
+++ b/manim/default.cfg
@@ -17,12 +17,13 @@
# -w, --write_to_movie
write_to_movie = True
-# -a, --write_all
-write_all = False
-
# -s, --save_last_frame
+# setting save_last_frame to True forces write_to_movie to False
save_last_frame = False
+# -a, --write_all
+write_all = False
+
# -g, --save_pngs
save_pngs = False