Skip to content

Commit 472eaae

Browse files
Fix use of Mobject's deprecated get_*() and set_*() methods in Cairo tests (#3549)
* Fix Deprecation warnings in cairo tests * Fix animation/specialized.py
1 parent 9b18a86 commit 472eaae

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

manim/animation/specialized.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(
8484

8585
mob.move_to(self.focal_point)
8686
mob.save_state()
87-
mob.set_width(self.initial_width)
87+
mob.set(width=self.initial_width)
8888

8989
if fill_o:
9090
mob.set_opacity(self.initial_opacity)

manim/animation/transform_matching_parts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def get_mobject_parts(mobject: Mobject) -> list[Mobject]:
225225
def get_mobject_key(mobject: Mobject) -> int:
226226
mobject.save_state()
227227
mobject.center()
228-
mobject.set_height(1)
228+
mobject.set(height=1)
229229
result = hash(np.round(mobject.points, 3).tobytes())
230230
mobject.restore()
231231
return result

manim/mobject/graphing/number_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def get_number_mobject(
475475
num_mob.next_to(self.number_to_point(x), direction=direction, buff=buff)
476476
if x < 0 and self.label_direction[0] == 0:
477477
# Align without the minus sign
478-
num_mob.shift(num_mob[0].get_width() * LEFT / 2)
478+
num_mob.shift(num_mob[0].width * LEFT / 2)
479479
return num_mob
480480

481481
def get_number_mobjects(self, *numbers, **kwargs) -> VGroup:

manim/mobject/svg/svg_mobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,9 @@ def move_into_position(self) -> None:
441441
if self.should_center:
442442
self.center()
443443
if self.svg_height is not None:
444-
self.set_height(self.svg_height)
444+
self.set(height=self.svg_height)
445445
if self.svg_width is not None:
446-
self.set_width(self.svg_width)
446+
self.set(width=self.svg_width)
447447

448448

449449
class VMobjectFromSVGPath(VMobject, metaclass=ConvertToOpenGL):

manim/mobject/text/text_mobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def construct(self):
352352
)
353353
text6.scale(1.3).shift(DOWN)
354354
self.add(text1, text2, text3, text4, text5 , text6)
355-
Group(*self.mobjects).arrange(DOWN, buff=.8).set_height(config.frame_height-LARGE_BUFF)
355+
Group(*self.mobjects).arrange(DOWN, buff=.8).set(height=config.frame_height-LARGE_BUFF)
356356
357357
.. manim:: TextMoreCustomization
358358
:save_last_frame:

manim/mobject/value_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def construct(self):
7171

7272
def __init__(self, value=0, **kwargs):
7373
super().__init__(**kwargs)
74-
self.set_points(np.zeros((1, 3)))
74+
self.set(points=np.zeros((1, 3)))
7575
self.set_value(value)
7676

7777
def get_value(self) -> float:
@@ -132,7 +132,7 @@ def interpolate(self, mobject1, mobject2, alpha, path_func=straight_path()):
132132
Turns self into an interpolation between mobject1
133133
and mobject2.
134134
"""
135-
self.set_points(path_func(mobject1.points, mobject2.points, alpha))
135+
self.set(points=path_func(mobject1.points, mobject2.points, alpha))
136136
return self
137137

138138

0 commit comments

Comments
 (0)