Skip to content

'camera' attribute not found when setting background color of scene #774

@rohansatapathy

Description

@rohansatapathy

Description of bug / unexpected behavior

When I try to set the background of a scene using self.camera.background_color, I get an error upon rendering saying that the attribute camera doesn't exist.

Expected behavior

I expected the background color to set to the value I specified. When I try setting the background color with the -c flag in the command line, it works fine.

How to reproduce the issue

Code for reproducing the problem

scene.py

class ManimCELogo(Scene):
    def construct(self):
        self.camera.background_color = "#ece6e2"
        logo_green = "#87c2a5"
        logo_blue = "#525893"
        logo_red = "#e07a5f"
        logo_black = "#343434"
        ds_m = MathTex(r"\mathbb{M}", fill_color=logo_black).scale(7)
        ds_m.shift(2.25 * LEFT + 1.5 * UP)
        circle = Circle(color=logo_green, fill_opacity=1).shift(LEFT)
        square = Square(color=logo_blue, fill_opacity=1).shift(UP)
        triangle = Triangle(color=logo_red, fill_opacity=1).shift(RIGHT)
        logo = VGroup(triangle, square, circle, ds_m)  # order matters
        logo.move_to(ORIGIN)
        self.add(logo)

rendering command used:
manim scene.py ManimCELogo -sql

Logs

Terminal output
[11/25/20 10:51:27] DEBUG    Read configuration files: ['/Users/my-user-name/.pyenv/versions/3.8.5/lib/python3.8/site config.py:164
                             -packages/manim/config/default.cfg']                                                                    



Traceback (most recent call last):
  File "/Users/my-user-name/.pyenv/versions/3.8.5/lib/python3.8/site-packages/manim/__main__.py", line 75, in main
    scene.render()
  File "/Users/my-user-name/.pyenv/versions/3.8.5/lib/python3.8/site-packages/manim/scene/scene.py", line 88, in render
    self.construct()
  File "scene.py", line 123, in construct
    self.camera.background_color = "#ece6e2"
AttributeError: 'ManimCELogo' object has no attribute 'camera'

System specifications

System Details
  • OS: macOS 10.15 (Catalina)
  • RAM: 16 GB
  • Python version (python/py/python3 --version): Python 3.8.5
  • Installed modules (provide output from pip list):
Package           Version
----------------- ----------
appdirs           1.4.4
cairocffi         1.2.0
certifi           2020.6.20
cffi              1.14.3
colorama          0.4.4
colour            0.1.5
commonmark        0.9.1
distlib           0.3.1
filelock          3.0.12
grpcio            1.33.2
grpcio-tools      1.33.2
manimce           0.1.0
numpy             1.19.4
pangocairocffi    0.3.2
pangocffi         0.6.0
pathtools         0.1.2
Pillow            8.0.1
pip               20.1.1
pipenv            2020.6.2
progressbar       2.5
protobuf          3.14.0
pycairo           1.20.0
pycparser         2.20
pydub             0.24.1
pygame            2.0.0.dev6
Pygments          2.7.2
rich              9.2.0
scipy             1.5.4
setuptools        47.1.0
six               1.15.0
tqdm              4.52.0
typing-extensions 3.7.4.3
virtualenv        20.0.30
virtualenv-clone  0.5.4
watchdog          0.10.3
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020): MacTeX-2020
  • Installed LaTeX packages: none
FFMPEG

Output of ffmpeg -version:

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.27)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_4 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100

Metadata

Metadata

Assignees

No one assigned

    Labels

    pr:bugfixBug fix for use in PRs solving a specific issue:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions