Skip to content

Notebook

avnlearn edited this page Sep 16, 2024 · 1 revision

Key Components

  1. Footer Function:

    • Creates a footer rectangle at the bottom of the screen with customizable width, height, fill color, and opacity.
  2. Text Classes:

    • Text: A custom text class that allows for alignment options.
    • Paragraph: A custom paragraph class that wraps text and allows for alignment.
    • Tex: A custom class for LaTeX text with alignment options.
    • MathTex: Similar to Tex but specifically for mathematical expressions.
    • MarkupText: A class for displaying text with markup support.
  3. Notebook Class:

    • Represents a notebook that arranges its contents. It can arrange its submobjects in a specified direction and can be centered.
  4. Question and Answer Classes:

    • QuestionText: Represents a question with language support and customizable styles.
    • AnswerText: Represents an answer with language support.
    • SolutionText: Represents a solution with language support.
    • QGroup: A group of questions that arranges them in a specified direction.
    • AGroup: A group of answers that can include a solution text.

Example Usage

To use these classes in a Manim scene, you can create instances of QuestionText, AnswerText, and their respective groups (QGroup, AGroup). Here’s a simple example:

from manim import *

class MyScene(Scene):
    def construct(self):
        # Create a footer
        footer = Footer(width=10, fill_color=BLUE)
        self.add(footer)

        # Create a group of questions
        question1 = QuestionText(1, lang="en")
        question2 = QuestionText(2, lang="en")
        q_group = QGroup(question1, question2, lang="en")
        self.add(q_group)

        # Create a group of answers
        answer1 = AnswerText(lang="en")
        answer2 = AnswerText(lang="en")
        a_group = AGroup(answer1, answer2, lang="en")
        self.add(a_group)

        self.wait(2)

Clone this wiki locally