Skip to content

Commit bd1f507

Browse files
committed
Added docs to docstrings
1 parent 9bb2a6c commit bd1f507

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

manim/mobject/types/image_mobject.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,38 @@ def reset_points(self):
4949

5050

5151
class ImageMobject(AbstractImageMobject):
52+
"""Displays an Image from a numpy array or a file.
53+
54+
Examples
55+
--------
56+
.. manim:: ImageFromArray
57+
:save_last_frame:
58+
59+
class ImageFromArray(Scene):
60+
def construct(self):
61+
image = ImageMobject(np.uint8([[0, 100, 30, 200],
62+
[255, 0, 5, 33]]))
63+
image.set_height(7)
64+
self.add(image)
65+
66+
.. manim:: ImageFromFile
67+
:save_last_frame:
68+
69+
class ImageFromFile(Scene):
70+
def construct(self):
71+
# Use PIL when you want to import an image from the web
72+
import requests
73+
from PIL import Image
74+
img = Image.open(requests.get("https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/cropped.png",
75+
stream=True).raw)
76+
img_mobject = ImageMobject(img)
77+
# this line, when you want to import your Image on your machine
78+
# img_mobject = ImageMobject("<your image address>")
79+
img_mobject.scale(3)
80+
self.add(img_mobject)
81+
82+
"""
83+
5284
CONFIG = {
5385
"invert": False,
5486
"image_mode": "RGBA",

manim/scene/scene.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,10 @@ def play_internal(self, *args, **kwargs):
781781
782782
Parameters
783783
----------
784-
*args : Animation or mobject with mobject method and params
785-
**kwargs : named parameters affecting what was passed in *args e.g run_time, lag_ratio etc.
784+
args
785+
Animation or mobject with mobject method and params
786+
kwargs
787+
named parameters affecting what was passed in ``args`` e.g. ``run_time``, ``lag_ratio`` etc.
786788
"""
787789
if len(args) == 0:
788790
warnings.warn("Called Scene.play with no animations")

0 commit comments

Comments
 (0)