From 48dad34f957abce4cefec06052fefe5325e39ac2 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Sat, 20 Jan 2018 11:00:23 -0800 Subject: [PATCH] Editing ApplyMethod so that if the last arg is a dict, it's treated as kwargs for the method --- animation/transform.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/animation/transform.py b/animation/transform.py index e63b8586..e47e6c3c 100644 --- a/animation/transform.py +++ b/animation/transform.py @@ -143,7 +143,13 @@ class ApplyMethod(Transform): "the method you want to animate" ) assert(isinstance(method.im_self, Mobject)) - method_kwargs = kwargs.get("method_kwargs", {}) + args = list(args) #So that args.pop() works + if "method_kwargs" in kwargs: + method_kwargs = kwargs["method_kwargs"] + elif isinstance(args[-1], dict): + method_kwargs = args.pop() + else: + method_kwargs = {} target = method.im_self.copy() method.im_func(target, *args, **method_kwargs) Transform.__init__(self, method.im_self, target, **kwargs)