Ejemplo n.º 1
0
 def get_quote(self, max_width=FRAME_WIDTH - 1):
     text_mobject_kwargs = {
         "alignment": "",
         "arg_separator": self.quote_arg_separator,
     }
     if isinstance(self.quote, str):
         if self.use_quotation_marks:
             quote = TexText("``%s''" % self.quote.strip(),
                             **text_mobject_kwargs)
         else:
             quote = TexText("%s" % self.quote.strip(),
                             **text_mobject_kwargs)
     else:
         if self.use_quotation_marks:
             words = [self.text_size + " ``"] + list(self.quote) + ["''"]
         else:
             words = [self.text_size] + list(self.quote)
         quote = TexText(*words, **text_mobject_kwargs)
         # TODO, make less hacky
         if self.quote_arg_separator == " ":
             quote[0].shift(0.2 * RIGHT)
             quote[-1].shift(0.2 * LEFT)
     for term, color in self.highlighted_quote_terms:
         quote.set_color_by_tex(term, color)
     quote.to_edge(UP, buff=self.top_buff)
     if quote.get_width() > max_width:
         quote.set_width(max_width)
     return quote
Ejemplo n.º 2
0
 def add_title(self, title="Sample space", buff=MED_SMALL_BUFF):
     # TODO, should this really exist in SampleSpaceScene
     title_mob = TexText(title)
     if title_mob.get_width() > self.get_width():
         title_mob.set_width(self.get_width())
     title_mob.next_to(self, UP, buff=buff)
     self.title = title_mob
     self.add(title_mob)