Bug fix to ApplyMethod treatment of method kwargs

This commit is contained in:
Grant Sanderson
2018-01-20 11:45:47 -08:00
parent 7c9f5ca711
commit 1ffbc77eda
3 changed files with 3 additions and 3 deletions

View File

@ -146,7 +146,7 @@ class ApplyMethod(Transform):
args = list(args) #So that args.pop() works
if "method_kwargs" in kwargs:
method_kwargs = kwargs["method_kwargs"]
elif isinstance(args[-1], dict):
elif len(args) > 0 and isinstance(args[-1], dict):
method_kwargs = args.pop()
else:
method_kwargs = {}

View File

@ -180,7 +180,7 @@ class Mobject(object):
kwargs["about_point"] = ORIGIN
self.apply_points_function_about_point(
lambda points : np.apply_along_axis(function, 1, points),
about_point = about_point, **kwargs
**kwargs
)
return self

View File

@ -366,7 +366,7 @@ class Scene(object):
else:
mobject.target = mobject.copy()
#
if isinstance(state["method_args"][-1], dict):
if len(state["method_args"]) > 0 and isinstance(state["method_args"][-1], dict):
method_kwargs = state["method_args"].pop()
else:
method_kwargs = {}