diff --git a/constants.py b/constants.py index 6efe1a1d..496fcbc1 100644 --- a/constants.py +++ b/constants.py @@ -79,6 +79,12 @@ TEX_IMAGE_DIR = TEX_DIR #TODO, What is this doing? MOBJECT_DIR = os.path.join(FILE_DIR, "mobjects") IMAGE_MOBJECT_DIR = os.path.join(MOBJECT_DIR, "image") +if not os.path.exists(MEDIA_DIR): + raise Exception(""" + Redefine MEDIA_DIR in constants.py to point to + a valid directory where movies and images will + be written + """) for folder in [FILE_DIR, RASTER_IMAGE_DIR, SVG_IMAGE_DIR, ANIMATIONS_DIR, TEX_DIR, TEX_IMAGE_DIR, MOBJECT_DIR, IMAGE_MOBJECT_DIR, STAGED_SCENES_DIR]: diff --git a/mobject/tex_mobject.py b/mobject/tex_mobject.py index fe5a3cdd..8401f5b7 100644 --- a/mobject/tex_mobject.py +++ b/mobject/tex_mobject.py @@ -87,7 +87,7 @@ class TexMobject(SVGMobject): should_replace = reduce(op.and_, [ t1 in tex, t2 not in tex, - len(tex) > len(t1) and tex[len(t1)] in "()[]|\\" + len(tex) > len(t1) and tex[len(t1)] in "()[]<>|.\\" ]) if should_replace: tex = tex.replace(t1, "\\big") @@ -166,9 +166,16 @@ class TexMobject(SVGMobject): part.highlight(color) return self - def highlight_by_tex_to_color_map(self, tex_to_color_map): - for tex, color in tex_to_color_map.items(): - self.highlight_by_tex(tex, color) + def highlight_by_tex_to_color_map(self, texs_to_color_map, **kwargs): + for texs, color in texs_to_color_map.items(): + try: + # If the given key behaves like strings + texs + '' + self.highlight_by_tex(texs, color, **kwargs) + except TypeError: + # If the given key is a tuple + for tex in texs: + self.highlight_by_tex(tex, color, **kwargs) return self def index_of_part(self, part): diff --git a/topics/objects.py b/topics/objects.py index c8c4d13a..7fc5d69b 100644 --- a/topics/objects.py +++ b/topics/objects.py @@ -493,6 +493,8 @@ class Broadcast(LaggedStart): "small_radius" : 0.0, "big_radius" : 5, "n_circles" : 5, + "start_stroke_width" : 8, + "color" : WHITE, "remover" : True, "lag_ratio" : 0.7, "run_time" : 3, @@ -510,7 +512,7 @@ class Broadcast(LaggedStart): circle.move_to(focal_point) circle.save_state() circle.scale_to_fit_width(self.small_radius*2) - circle.set_stroke(WHITE, 8) + circle.set_stroke(self.color, self.start_stroke_width) circles.add(circle) LaggedStart.__init__( self, ApplyMethod, circles,