3b1b / 3b1b/manim

Opening quote highlighting doesn't work

Aberta
#262 3 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
93.9k
Forks
7.7k
Merge médio
2d 13h
PRs com merge (30d)
4

Descrição

I'm running through some of the older examples and playing with opening quotes. It seems like opening quote highlighting isn't working.

Consider the toy example (although any opening quote from the eoc/eola projects does this):
```
class FunnyOpeningQuote(OpeningQuote):
CONFIG = {
"quote" : [
"I am ",
"error",
".",
],
"highlighted_quote_terms" : {
"error" : RED,
},
"author" : "A wise man"
}
```

When generating a video from this with `python extract_scene.py my_scenes.py FunnyOpeningQuote -pl` the following error occurs
```
Traceback (most recent call last):
File "extract_scene.py", line 273, in main
handle_scene(SceneClass(**scene_kwargs), **config)
File "/home/graham/Programming/Python/manim/scene/scene.py", line 71, in __init__
self.construct(*self.construct_args)
File "/home/graham/Programming/Python/manim/for_3b1b_videos/common_scenes.py", line 48, in construct
self.quote = self.get_quote()
File "/home/graham/Programming/Python/manim/for_3b1b_videos/common_scenes.py", line 78, in get_quote
for term, color in self.highlighted_quote_terms:
ValueError: too many values to unpack
```

This seems like a string parsing error on the part of library, so I looked a little further into it and if I were to provide the following example:
```
class FunnyOpeningQuote(OpeningQuote):
CONFIG = {
"quote" : [
"I am ",
"error",
".A",
],
"highlighted_quote_terms" : {
".A" : RED,
},
"author" : "A wise man"
}
```

Then the error provides more useful information:
```
...
File "/home/graham/.local/lib/python2.7/site-packages/colour.py", line 990, in __setattr__
fc(value)
File "/home/graham/.local/lib/python2.7/site-packages/colour.py", line 1071, in set_web
self.hex = web2hex(value)
File "/home/graham/.local/lib/python2.7/site-packages/colour.py", line 667, in web2hex
raise ValueError("%r is not a recognized color." % web)
ValueError: 'a' is not a recognized color.
```

To me, this is telling me that instead of reading it as a string followed by a color value, this is reading the entire thing as a sequence of characters followed by a color at the end. I'm not strong on python language, but I'm assuming that this means the following line from `common_scenes.py` needs to be modified in some way
``
for term, color in self.highlighted_quote_terms:
quote.set_color_by_tex(term, color)
``

Let me know if this is a real issue or if I've gone completely bananas here.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.