set_color(COLOR) (and some other methods mostly used for manipulating the size, position etc. of objects on canvas) dont change the attributes associated with the object.
See original GitHub issueI don’t know if this is intentional but the setting methods especially those used for manipulating the position/color of objects on manim canvas don’t actually change these attributes. For example, here I am trying to change the color of the TextMobject using set_color() but it is not changing the color property associated with the object although its appearance on the canvas has been changed to the desired color.
class Testing(Scene):
def construct(self):
some_text = TextMobject("This is some text")
print("Color of the variable before applying set_color(): ",some_text.color)
self.play(Write(some_text))
self.wait()
self.remove(some_text)
some_text.set_color(GREEN_D)
print("Color of the variable after applying set_color(): ",some_text.color)
self.play(ShowCreation(some_text))
self.wait()
Here is the output:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Applying styles and colors - Web APIs | MDN
Here we will explore the canvas options we have at our disposal to make our ... You will learn how to add different...
Read more >Custom Graphics Programming - Java Programming Tutorial
In Java, custom painting is done via the java.awt.Graphics class, which manages a graphics context, and provides a set of device-independent methods for...
Read more >turtle — Turtle graphics — Python 3.11.1 documentation
The TurtleScreen class defines graphics windows as a playground for the drawing turtles. Its constructor needs a tkinter.Canvas or a ScrolledCanvas as argument....
Read more >TkDocs Tutorial - Canvas
A canvas widget manages a 2D collection of graphical objects — lines, circles, text, images, other widgets, and more. Tk's canvas is an...
Read more >HTML Canvas Reference - W3Schools
Colors, Styles, and Shadows ; createPattern(), Repeats a specified element in the specified direction ; createRadialGradient(), Creates a radial/circular gradient ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes sir. I was a little busy for the past two weeks. I will PR tomorrow if that is okay!
The vectorized M object class has its own
set_color(COLOR)
method defined where the COLOR passed is not set to the color attribute of the object. Looking at the method resolution order, TextMobject looks for the methodset_color(COLOR)
in VMobject.https://github.com/ManimCommunity/manim/blob/70c0d53a01ee6cd1da9a74c0338ed404f67b9123/manim/mobject/types/vectorized_mobject.py#L227-L230