Code Monkey home page Code Monkey logo

manim-slides's Introduction

Manim Slides Logo

Latest Release Python version PyPI - Downloads Documentation DOI JOSE Paper codecov Binder

Manim Slides

Tool for live presentations using either Manim (community edition) or ManimGL. Manim Slides will automatically detect the one you are using!

Note

This project extends the work of manim-presentation, with a lot more features!

Installation

Manim Slides requires either Manim or ManimGL to be installed, along with their dependencies. Please checkout the documentation for detailed install instructions.

Usage

Using Manim Slides is a two-step process:

  1. Render animations using Slide (resp. ThreeDSlide) as a base class instead of Scene (resp. ThreeDScene), and add calls to self.next_slide() every time you want to create a new slide.
  2. Run manim-slides on rendered animations and display them like a PowerPoint presentation.

The documentation is available online.

Basic Example

Call self.next_slide() every time you want to create a pause between animations, and self.next_slide(loop=True) if you want the next slide to loop over animations until the user presses continue:

from manim import *  # or: from manimlib import *

from manim_slides import Slide


class BasicExample(Slide):
    def construct(self):
        circle = Circle(radius=3, color=BLUE)
        dot = Dot()

        self.play(GrowFromCenter(circle))
        self.next_slide()  # Waits user to press continue to go to the next slide

        self.next_slide(loop=True)  # Start loop
        self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
        self.next_slide()  # This will start a new non-looping slide

        self.play(dot.animate.move_to(ORIGIN))

First, render the animation files:

manim-slides render example.py BasicExample
# or use ManimGL
manim-slides render --GL example.py BasicExample

Note

Using manim-slides render makes sure to use the manim (or manimlib) library that was installed in the same Python environment. Put simply, this is a wrapper around manim render [ARGS]... (or manimgl [ARGS]...).

To start the presentation using Scene1, Scene2 and so on, run:

manim-slides [OPTIONS] Scene1 Scene2...

In our example:

manim-slides BasicExample

Example GIF

For detailed usage documentation, run manim-slides --help, or go to the documentation.

Interactive Tutorial

Click on the image to watch a slides presentation that explains to you how to use Manim Slides.

Manim Slides Docs

More Examples

More examples are available in the example.py file, if you downloaded the git repository.

Comparison with Similar Tools

There exists a variety of tools that allows to create slides presentations containing Manim animations.

Below is a comparison of the most used ones with Manim Slides:

Project name Manim Slides Manim Presentation Manim Editor Jupyter Notebooks
Link GitHub Repo stars GitHub Repo stars GitHub Repo stars GitHub Repo stars
Activity GitHub Repo stars GitHub Repo stars GitHub Repo stars GitHub Repo stars
Usage Command-line Command-line Web Browser Notebook
Note Requires minimal modif. in scenes files Requires minimal modif. in scenes files Requires the usage of sections, and configuration through graphical interface Relies on nbconvert to create slides from a Notebook
Support for ManimGL Yes No No No
Web Browser presentations Yes No Yes No
Offline presentations Yes, with Qt Yes, with OpenCV No No

Contributing

Contributions are more than welcome! Please read through our contributing section.

Reporting an Issue

If you think you found a bug, an error in the documentation, or wish there was some feature that is currently missing, we would love to hear from you!

The best way to reach us is via the GitHub issues. If your problem is not covered by an already existing (closed or open) issue, then we suggest you create a new issue. You can choose from a list of templates, or open a blank issue if your issue does not fit one of the proposed topics.

The more precise you are in the description of your problem, the faster we will be able to help you!

Seeking for help

Sometimes, you may have a question about Manim Slides, not necessarily an issue.

First, make sure to read the F.A.Q to see if your question has already been answered. If not, please follow the recommendation (from that page) to reach us for questions.

Contact

Finally, if you do not have any GitHub account, or just wish to contact the author of Manim Slides, you can do so at: [email protected].

manim-slides's People

Contributors

ahmedsilat44 avatar bryanwweber avatar dependabot[bot] avatar dmadisetti avatar edibotopic avatar elliotwutingfeng avatar fairlight8 avatar felipecocco avatar galatolofederico avatar imgbot[bot] avatar jeertmans avatar linusheck avatar mikegillotti avatar pre-commit-ci[bot] avatar robotboyfriend avatar simanglam avatar taiyeoguns avatar tdadela avatar wucheng98 avatar yang-fighter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

manim-slides's Issues

[FEATURE] Official Python3.11 support

Description

Python 3.11 was released in October.
I think, it is good idea to add official support.

Action needed:

  1. add test builds for Python3.11,
  2. add Python3.11 README badge.

Screenshots

No response

Additional information

No response

[TEST] Enforce type hints with MyPy

What

In par with #34, I'd like to have some checks to assert that all functions, methods, and constants have type hints.

How to

This PR requires adding a pre-commit hook that using mypy. After the flake8 hook:

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- flake8-typing-imports

you need to add:

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: ''  # Use the sha / tag you want to point at
    hooks:
    -   id: mypy

and use customized arguments to make sure it only checks for type hints.

Useful links

[BUG] zsh: `command not found: manim-slides`

The installation of manim-slides, via pip3, worked totally fine. Initially compiling the example scene worked fine as well. However, running manim-slides Example doesn't work, and returns zsh: command not found: manim-slides. How do I fix this?

[BUG] Color contrast between slide and background in convert

Description

For some reason, there is a noticeable color difference between the background and the slide. I thought that it makes sense since the background color is a CSS plain color, and the slide is a render video. But in present mode, the color difference is almost invisible, extremely subtle, while it is bigger in convert mode.

Steps to reproduce

If you use this simple animation with red background, you will see the issue:

from manim import *
from manim_slides import Slide
config.background_color=RED

class TestColors(Slide):
    def construct(self):
        circ = Circle(color=WHITE)
        self.play(
            Create(circ)
        )
        self.pause()

Result when presenting directly with manim-slides:
present

Result when converting to html:
convert

If you pay attention, the background color is the same. What changes is the hue of the video. I don't really know what's happening since it is the same .mp4 video.

Any idea?

Version

4.11.0, with latest commits from git

Platform

Windows 10

Screenshots

No response

Additional information

No response

[DOC] Create nicer demo video / gif

What

The current example.gif was recorded a long time ago, when a lot of features did not exist, and I not quite attractive (in my opinion).

If possible, I like a small video / gif that shows, in a fews seconds, what you can do with manim-slides.

How to

Create (or modify) some example file that you will display during the example video, record yourself in such a way that you can clearly see what manim-slides is doing. A good approach to that is showing key presses with screenkey.

[BUG] Error when rendering with `-n` option

Description

Manim offers an option, -n/--from-animation-number, that allows to only render part of a Scene. The problem only occurs when the start index is higher than zero, not the opposite.

Version

Current, v4.9.2.

Platform

All

Screenshots

Manim Community v0.17.2

[03/08/23 10:28:21] INFO     Animation 1 : Using cached data (hash : 849281109_634683520_4174018169)                                                                                           cairo_renderer.py:78

Animation 1: Write(VGroup of 2 submobjects), etc.:   0%|          | 0/1 [00:00<?, ?it/s]
                                                                                        
                    INFO     Animation 2 : Using cached data (hash : 4007471538_2202726386_1950962615)                                                                                         cairo_renderer.py:78
                    INFO     Combining to Movie file.                                                                                                                                      scene_file_writer.py:617
                    INFO                                                                                                                                                                   scene_file_writer.py:736
                             File ready at '/home/jeertmans/repositories/jeertmans.github.io/_slides/2023-03-27-eucap-presentation/media/videos/main/480p15/Main.mp4'                                              
                                                                                                                                                                                                                   
                    INFO     Rendered Main                                                                                                                                                             scene.py:241
                             Played 3 animations                                                                                                                                                                   

Copying animation files to './slides/files/Main' and generating reversed animations:   0%|          | 0/3 [00:00<?, ?it/s]
                                                                                                                          
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /home/jeertmans/.local/lib/python3.10/site-packages/manim/cli/render/commands.py:115 in render   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   112 โ”‚   โ”‚   โ”‚   try:                                                                           โ”‚
โ”‚   113 โ”‚   โ”‚   โ”‚   โ”‚   with tempconfig({}):                                                       โ”‚
โ”‚   114 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   scene = SceneClass()                                                   โ”‚
โ”‚ โฑ 115 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   scene.render()                                                         โ”‚
โ”‚   116 โ”‚   โ”‚   โ”‚   except Exception:                                                              โ”‚
โ”‚   117 โ”‚   โ”‚   โ”‚   โ”‚   error_console.print_exception()                                            โ”‚
โ”‚   118 โ”‚   โ”‚   โ”‚   โ”‚   sys.exit(1)                                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/jeertmans/.local/lib/python3.10/site-packages/manim_slides/slide.py:230 in render          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   227 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   228 โ”‚   โ”‚   config["max_files_cached"] = max_files_cached                                      โ”‚
โ”‚   229 โ”‚   โ”‚                                                                                      โ”‚
โ”‚ โฑ 230 โ”‚   โ”‚   self.save_slides()                                                                 โ”‚
โ”‚   231                                                                                            โ”‚
โ”‚   232                                                                                            โ”‚
โ”‚   233 class ThreeDSlide(Slide, ThreeDScene):  # type: ignore                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/jeertmans/.local/lib/python3.10/site-packages/manim_slides/slide.py:183 in save_slides     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   180 โ”‚   โ”‚   โ”‚   ascii=True if platform.system() == "Windows" else None,                        โ”‚
โ”‚   181 โ”‚   โ”‚   โ”‚   disable=not self.show_progress_bar,                                            โ”‚
โ”‚   182 โ”‚   โ”‚   ):                                                                                 โ”‚
โ”‚ โฑ 183 โ”‚   โ”‚   โ”‚   filename = os.path.basename(src_file)                                          โ”‚
โ”‚   184 โ”‚   โ”‚   โ”‚   rev_filename = "{}_reversed{}".format(*os.path.splitext(filename))             โ”‚
โ”‚   185 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚   186 โ”‚   โ”‚   โ”‚   dst_file = os.path.join(scene_files_folder, filename)                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /usr/lib/python3.10/posixpath.py:142 in basename                                                 โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   139                                                                                            โ”‚
โ”‚   140 def basename(p):                                                                           โ”‚
โ”‚   141 โ”‚   """Returns the final component of a pathname"""                                        โ”‚
โ”‚ โฑ 142 โ”‚   p = os.fspath(p)                                                                       โ”‚
โ”‚   143 โ”‚   sep = _get_sep(p)                                                                      โ”‚
โ”‚   144 โ”‚   i = p.rfind(sep) + 1                                                                   โ”‚
โ”‚   145 โ”‚   return p[i:]                                                                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
TypeError: expected str, bytes or os.PathLike object, not NoneType

Additional information

No response

[BUG] File name too long

Description

When I have an scene with a certain number of elements I get error OSError: [Errno 36] File name too long: when I do manim-slides convert Graph graph.html.

Version

version 4.8.3

Platform

Linux Ubuntu 22.04

Screenshots

No response

Additional information

Code to reproduce the error:

import networkx as nx
from manim import *
from manim_slides import Slide

# Creating a random graph with 6 nodes and few edges
G = nx.gnp_random_graph(6, 0.5, seed=0)

# Obtaining the 2D coordinates of the graph nodes
pos = nx.spring_layout(G)


class Graph(Slide):
    def construct(self):
        circles = {}
        # Printing the 2D coordinates of the nodes
        for node, coord in pos.items():
            print("Node:", node, "Coordinates:", coord)
            circle = Circle(radius=.25)
            circles[node] = circle
            circle.set_fill(WHITE, opacity=1.0)
            circle.set_stroke(RED, width=.5)
            position = coord[0] * RIGHT + coord[1] * UP
            print(f"{position=}")
            circle.shift(position)
            self.play(Create(circle))

        edges = []
        for edge in G.edges:
            dot_0 = circles[edge[0]]
            dot_1 = circles[edge[1]]
            line = Line(dot_0.get_center(), dot_1.get_center(), color=PURPLE)
            edges.append(line)
            self.play(Create(line))
        self.pause()

[FEATURE] read background color from `manim.config`, save it in config and use it in Manim-Slides

Description

As mentioned in #128 (comment), it would be nice to use the save background color as the one used with Manim (or ManimGL).

A few to-dos:

  • Add a new background_color field in
    class PresentationConfig(BaseModel): # type: ignore
    slides: List[SlideConfig]
    files: List[str]
  • Read background_color from Manim / ManimGL config and write it somewhere in
    class Slide(Scene): # type:ignore
    """
    Inherits from :class:`manim.scene.scene.Scene` or :class:`manimlib.scene.scene.Scene` and provide necessary tools for slides rendering.
    """
    def __init__(
    self, *args: Any, output_folder: str = FOLDER_PATH, **kwargs: Any
    ) -> None:
    if MANIMGL:
    if not os.path.isdir("videos"):
    os.mkdir("videos")
    kwargs["file_writer_config"] = {
    "break_into_partial_movies": True,
    "output_directory": "",
    "write_to_movie": True,
    }
    kwargs["preview"] = False
    super().__init__(*args, **kwargs)
    self.output_folder = output_folder
    self.slides: List[SlideConfig] = []
    self.current_slide = 1
    self.current_animation = 0
    self.loop_start_animation: Optional[int] = None
    self.pause_start_animation = 0
  • Default to presentation background color if --background-color/-cbackground-color option is not set in present
    @click.option(
    "--background-color",
    "--bgcolor",
    "background_color",
    metavar="COLOR",
    type=str,
    default="black",
    help='Set the background color for borders when using "keep" resize mode. Can be any valid CSS color, e.g., "green", "#FF6500" or "rgba(255, 255, 0, .5)".',
    show_default=True,
    )
    and in convert
    background_color: str = "black" # TODO: use pydantic.color.Color

Screenshots

No response

Additional information

No response

[BUG] manim-slides no longer work on M1 chip

Description

manim-slides no longer work on M1 chip (or arm64) because of pyqt5. Using Rosetta terminal is not an option.

Version

v.4.2.0

Platform

macOS arm64

Screenshots

No response

Additional information

pip install manim-slides==4.2.0
Collecting manim-slides==4.2.0
  Using cached manim-slides-4.2.0.tar.gz (31 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: tqdm>=4.62.3 in /Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages (from manim-slides==4.2.0) (4.64.1)
Requirement already satisfied: numpy>=1.19.3 in /Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages (from manim-slides==4.2.0) (1.23.4)
Requirement already satisfied: click>=8.0 in /Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages (from manim-slides==4.2.0) (8.1.3)
Requirement already satisfied: opencv-python>=4.6 in /Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages (from manim-slides==4.2.0) (4.6.0.66)
Collecting pyqt5>=5.15
  Using cached PyQt5-5.15.7.tar.gz (3.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  ร— Preparing metadata (pyproject.toml) did not run successfully.
  โ”‚ exit code: 1
  โ•ฐโ”€> [29 lines of output]
      Traceback (most recent call last):
        File "/Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/xxxx/Library/Caches/pypoetry/virtualenvs/ai-conf-presentation-myrB_ykU-py3.9/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/var/folders/15/yly5qc49661d3rkdfl04fnvc0000gp/T/pip-build-env-pxb2eug4/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/private/var/folders/15/yly5qc49661d3rkdfl04fnvc0000gp/T/pip-build-env-pxb2eug4/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/private/var/folders/15/yly5qc49661d3rkdfl04fnvc0000gp/T/pip-build-env-pxb2eug4/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 585, in setup
          self.apply_user_defaults(tool)
        File "project.py", line 69, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/private/var/folders/15/yly5qc49661d3rkdfl04fnvc0000gp/T/pip-build-env-pxb2eug4/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/private/var/folders/15/yly5qc49661d3rkdfl04fnvc0000gp/T/pip-build-env-pxb2eug4/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 236, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/private/var/folders/15/yly5qc49661d3rkdfl04fnvc0000gp/T/pip-build-env-pxb2eug4/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 69, in apply_user_defaults
          raise PyProjectOptionException('qmake',
      sipbuild.pyproject.PyProjectOptionException
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

ร— Encountered error while generating package metadata.
โ•ฐโ”€> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[BUG] Low resolution in Windows

Hi there. Thank you so much for maintaining this.

Unfortunately, I couldn't get the HD resolution in Windows. Here's how it looks like:
image
but supposed to be:
image

I tried setting the resolution to 1920x1080, but it didn't work.

[FEATURE] faster (or lazy) module import

Description

Currently, Manim Slides' CLI is quite slow due to an import overhead caused by importing manim or manimlib, even though most of it is not needed.

Calling manim-slides --help takes more than 1s on my computer, when 90+ % of the time taken for importing useless modules.

However, manim-like dependencies are only ever needed when rendering slides, thus in manim_slides/slides.py.

The only attributes that are used across all tools are FFMPEG_BIN and logger, but those could be easily created apart, and eventually read options from CLI's arguments if configuration is needed (such as specifying ffmpeg's path).

A solution to this should be found, allowing for a faster CLI.

Screenshots

Snakeviz visualization when calling manim-slides --help:
image

Additional information

Lazy module import is only planned to be part of Python 3.12, see PEP0690, so an alternative solution should be found.

[BUG] Cannot use `manim-slides` on WSL 2 with Ubuntu 20.04

Please explain the issue you're experiencing (with as much detail as possible):

Was excited to use manim-slides but unfortunately, there's a runtime error I can't figure out with manimpango library.

when I run the manim-slides command with a scene. the traceback points me to a manimpango import error.

ImportError:

ManimPango could not import and load the necessary shared libraries.
This error may occur when ManimPango and its dependencies are improperly set up.
Please make sure the following versions are what you expect:

    * ManimPango v0.4.2, Python v3.9.15

If you believe there is a greater problem,
feel free to contact us or create an issue on GitHub:

    * Discord: https://www.manim.community/discord/
    * GitHub: https://github.com/ManimCommunity/ManimPango/issues

Original error: manim-env/lib/libgobject-2.0.so.0: undefined symbol: g_uri_ref 

I have tried several versions of manimpango and I don't have any issues running manim and I can also generate the mp4 files for the slides.

Any help would be greatly appreciated.
TIA!

[BUG] Low resolution on Linux

Description

I've run following commands:

$ manim render example.py ThreeDExample
$ manim-slides ThreeDExample # This results in a low quality animation, but with slides
$ mpv "$(pwd)"/media/videos/main/2160p60/ThreeDExample.mp4 # This results in a high quality animation

This leads me to believe that manim-slides converts the mp4 files in a way that leads to a reduction of quality.

Version

manim-slides, version 4.2.0

Platform

Linux, version 6.0.2-arch1-1

Screenshots

Look at the arrows of the coordinate system, the arrow in the video is clearly sharper.
Using manim-slides ThreeDExample:
1666504743

Using mpv "$(pwd)"/media/videos/main/2160p60/ThreeDExample.mp4:
1666504244

Additional information

Python version: 3.10.8
Qt specific environment variables:

  • QT_QPA_PLATFORM=wayland
  • QT_QPA_PLATFORMTHEME=qt5ct

wayland compositor:
river, compiled without xwayland support

[FEATURE] manim-slides jupyter magic

Description

Super cool project, thanks for doing this.

I'd love to be able to run this seamlessly in a Jupyter notebook. It's almost there, looks like a simple magic could do the trick. What do you think?

In the example below, we have:

%%manim -qm -v WARNING BasicExample

as the magic, so for the magic, I'd expect we'd want syntax like

%%manim-slides BasicExample

Which should read in the script and return an HTML IPython object with the revealjs page

Screenshots

ici voila

Screenshot Capture - 2023-02-07 - 13-40-00

Additional information

Here's the notebook: https://colab.research.google.com/drive/1K2EVdySR7H5DtLstFtX8h2mvtSW7af6O?usp=sharing

[BUG] can't run manim-slides on ubuntu (from within conda environments)

Description

After following the installation steps, running manim-slides in a command line (oh-my-zsh) yields:

Traceback (most recent call last):
  File "/home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manimpango/__init__.py", line 14, in <module>
    from .cmanimpango import *  # noqa: F403,F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: /home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manimpango/../../../libgobject-2.0.so.0: undefined symbol: g_uri_ref

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/incognito/anaconda3/envs/manim-slides/bin/manim-slides", line 5, in <module>
    from manim_slides.__main__ import cli
  File "/home/incognito/Repositories/manim-slides/manim_slides/__init__.py", line 3, in <module>
    from .slide import Slide, ThreeDSlide
  File "/home/incognito/Repositories/manim-slides/manim_slides/slide.py", line 9, in <module>
    from .config import PresentationConfig, SlideConfig, SlideType
  File "/home/incognito/Repositories/manim-slides/manim_slides/config.py", line 11, in <module>
    from .manim import FFMPEG_BIN, logger
  File "/home/incognito/Repositories/manim-slides/manim_slides/manim.py", line 76, in <module>
    from manim import Scene, ThreeDScene, config, logger
  File "/home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manim/__init__.py", line 32, in <module>
    from .animation.numbers import *
  File "/home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manim/animation/numbers.py", line 10, in <module>
    from manim.mobject.text.numbers import DecimalNumber
  File "/home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manim/mobject/text/numbers.py", line 15, in <module>
    from manim.mobject.text.text_mobject import Text
  File "/home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manim/mobject/text/text_mobject.py", line 64, in <module>
    import manimpango
  File "/home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manimpango/__init__.py", line 35, in <module>
    raise ImportError(msg)
ImportError: 

ManimPango could not import and load the necessary shared libraries.
This error may occur when ManimPango and its dependencies are improperly set up.
Please make sure the following versions are what you expect:

    * ManimPango v0.4.3, Python v3.11.0

If you believe there is a greater problem,
feel free to contact us or create an issue on GitHub:

    * Discord: https://www.manim.community/discord/
    * GitHub: https://github.com/ManimCommunity/ManimPango/issues

Original error: /home/incognito/anaconda3/envs/manim-slides/lib/python3.11/site-packages/manimpango/../../../libgobject-2.0.so.0: undefined symbol: g_uri_ref

Activating python and doing import manimpango works fine though. Not sure what the issue is.

Version

manim-slides --version gives that same error ^ and stacktrace.

Platform

lsb_release -a gives:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.5 LTS
Release:	20.04
Codename:	focal

Screenshots

No response

Additional information

No response

[DOC] JOSE Paper: Improve statement of need

Describe the Issue

From the JOSE Reviewer Guidelines:

A statement of need: Do the authors clearly state the need for this software and who the target audience is?

The paper.md does include a brief statement of need for the software, explaining that being able create slideshows from Manim animations is useful. I agree with this. I think the authors should also include information about the target audience and ways that those audiences might find this software useful, specifically. This does not have to be long, maybe 1-2 paragraphs at most.

Affected Page

paper.md

Issue Type

Documentation Enhancement

Recommended fix or suggestions

No response

[DOC] Add pull request template

What

I'd like to make this repo easier to manage by creating a template for pull requests.

The documentation for creating templates on GitHub can be found here: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository.

What to include in the template

Here is what I would like to find in the template:

  • a description section
  • does this solve an issue? If so, reference the issue, or describe it
  • some checkboxes to make stating
    • I understand that my contributions needs to pass the checks
    • If I create new functions / methods, I documented them and add type hints
    • If I modified already existing code, I updated the documentation accordingly
  • additional contents: images, error output, ...

[FEATURE] start from a given slide / animation

Description

In link with #149, it would be nice to be able to start from a given slide number (-s/--slides n) or a given animation (-a/--animation n).

Screenshots

No response

Additional information

No response

[DOC] Add issue template

What

I'd like to make this repo easier to manage by creating a template for issues.

The documentation for creating templates on GitHub can be found here: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository.

What to include in the template

Here is what I would like to find in the template:

  • a description section
  • platform description (i.e., what is your OS? Windows, macOS, or Linux (Wayland or X))
  • how to reproduce the error
  • additional contents: images, error output, ...

[FEATURE] Manim Web support

Description

So, there's this version of manim that allows you to create interactive diagrams, is there (or could there be in the future) a way to embed one of those inside a slide? Here's the site and some examples of diagrams I made that I'd like to embed into a slide:

P.S.: forgot to mention that the exports of manim web can also be .html files with an .js script, maybe that will ease things up

Screenshots

No response

Additional information

No response

[BUG] Docs are not built correctly

Describe the Issue

It seems like the docs build fails:

Running Sphinx v6.1.3
making output directory... done
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
/home/runner/work/manim-slides/manim-slides/docs/source/index.rst:26: ERROR: Failed to import "cli" from "manim_slides.__main__". The following exception was raised:
Traceback (most recent call last):

  File "/opt/hostedtoolcache/Python/3.9.[16](https://github.com/jeertmans/manim-slides/actions/runs/3999057965/jobs/6862480885#step:10:17)/x64/lib/python3.9/site-packages/sphinx_click/ext.py", line 403, in _load_module
looking for now-outdated files... none found
    mod = __import__(module_name, globals(), locals(), [attr_name])
ModuleNotFoundError: No module named 'manim_slides'
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index

generating indices... genindex done
writing additional pages... search done
copying images... [100%] _static/logo.png

copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 1 warning.

The HTML pages are in build/html.

Affected Page

index.html

Issue Type

Documentation Report

Recommended fix or suggestions

To be determined.

[DOC] JOSE Paper (paper.md) Feature Improvements Over Forked Repo

Describe the Issue

Related to JOSE Review openjournals/jose-reviews#206

paper.md does not include enumerated list of features added or changed over the original forked repo https://github.com/galatolofederico/manim-presentation

While a perusal of the submissions repo itself can clarify it, it should be summarized more specifically in the paper.md for the submission.

Affected Page

https://github.com/openjournals/jose-papers/blob/jose.00206/jose.00206/10.21105.jose.00206.pdf

Issue Type

Documentation Enhancement

Recommended fix or suggestions

include enumerated list of features added or changed over the original forked repo

[FEATURE] setting background color with `aspect-ratio=keep`

Description

When using aspect-ratio=keep, the background color is white.
However, this might look weird on presentations with, e.g., black background color.

I propose to add a background color option in the CLI, that defaults to black.

Screenshots

The goal is to change the color of the borders.

image

Example of desired output with background-color=black:

image

Additional information

All the changes should occur in manim_slides/present.py.

First, create a new keyword argument to App.__init__ called

background_color: str = "black"

Then, after self.label = QLabel(self), write

self.label.setStyleSheet(f"background-color: {background_color}")

After that, you need to add a new argument to the CLI (see @click.option) and pass it to the App instance.

[DOC] Improving the overall documentation

Describe the Issue

Currently, only the CLI is documented on GitHub pages, and the remaining is partially documented on the README.

It would be great to have a better documentation, as it is done for Manim Community, where everything can be seen in one place.

Affected Page

All

Issue Type

Documentation Enhancement

Recommended fix or suggestions

I recommend to use Sphinx and the docs directory to create more documentations, especially examples.

[BUG] Missing slides-folder and JSON

Description

Hello!

I have encountered a problem with manim-slides:
After i rendered my Scenes (or Slides, to be more precise) i am not able to present them to test the Functionality.

i gave it a try by using manim-slides present Test2

I get the following error:

Usage: manim-slides present [OPTIONS] [SCENES]...

Error: Invalid value for '--folder': Directory './slides' does not exist.

I already tried creating the "slides" folder manually. After doing so, i get the following error:

Usage: manim-slides present [OPTIONS] [SCENES]...

Error: File ./slides\Test2.json does not exist, check the scene name and make sure to use Slide as your scene base class

Even though i use "Slide" as my base class

It seems to not create the needed Folder or JSON so i cant use the Library at all

Any Help is greatly apprechiated!

PS: Im fairly new to Manim and it might be the case im just stupid and am missing something obvious, if this is the case i would extra-apprechiate some help with the descripted problem :) )

Version

manim-slides, version 4.8.0

Platform

Windows 11

Screenshots

No response

Additional information

No response

[DOC] Add more issue templates

What

With #39 and #40, users can now create issues based on template. However, I'd like to have more template, in line to what is done in the numpy/numpy repository: https://github.com/numpy/numpy/issues/new/choose.

I would love to have templates for

  • Documentation
  • Question/Help/Support

You can get inspiration from the Numpy repository (see above), but I won't be using external links.

How to

Please, read already existing files in ISSUE_TEMPLATE, and get some inspiration from https://github.com/numpy/numpy/issues/new/choose too.

[DOC] Improve installation documentation with a full end-to-end procedure

Describe the Issue

From the JOSE review criteria:

Installation: Does installation proceed as outlined in the documentation? (and documentation is sufficient?)

The installation documentation clearly states the need to install ManimCE or ManimGL, which is appreciated. I'm curious why these are not declared as dependencies of the package? Especially in the quickstart, I think it would be nice to be opinionated about installing one or the other to show a full installation flow. It can always include a link to the other, but full instructions (I have only a venv created all the way to running an example) would be nice in the quickstart.

Affected Page

https://eertmans.be/manim-slides/quickstart.html

Issue Type

Documentation Enhancement

Recommended fix or suggestions

No response

[BUG] Low FPS on Windows

Please explain the issue you're experiencing (with as much detail as possible):

I tried using the code in the readme, and it's all good if I use the command:

manim -pqh main.py Example

However, when I try to use manim-slides to generate the slides using the command:

manim-slides Example --fullscreen

Or even without the --fullscreen flag, the fps of the animations is lower, and the videos inside the media folder seems smoother. But when I open the videos on the slides folder, it has the same fps as the video in the media folder.

Is there any way to make the fps the same?

[FEATURE] Add an option/flag to hide mouse cursor

Description

I am using manim-slides for live presentation and there does not seem to be an option to hide the cursor and I have to put it in a screen corner so it does not hinder the presentation which is annoying.

Screenshots

No response

Additional information

I'm using version 4.1.1 on Windows 11.

[BUG] Slideshow runs in wrong resolution.

When launching slides with manim-slides command the opened window has the wrong resolution. It is off the screen tall and skinny. This issue is not present when launching with full screen tag.

[TEST] Add missing type hints

What

Some files have functions with missing type hints in their signature.

Here is an up-to-date list of files to complete:

How to contribute

Please modify file(s) such that:

  • every function should have a type hint for each parameter, and for return parameter,
  • type hints should be compatible with Python 3.7 (so things like x: str | None are not accepted, instead use x: Optional[str]),
  • self in methods should not take any type hint,
  • constant declaration should have type hint (e.g., MANIM_AVAILABLE: bool = ...),
  • and use types from Typing module only when necessary (so prefer list over typing.List if the list elements type is Any).

Multiple PRs

Since the number of files to be changed is large, feel free to only modify one file or so per PR.

[DOC] Improve contributions documentation

Describe the Issue

From the JOSE Reviewer Guidelines:

Community guidelines: Are there clear guidelines for third parties wishing to 1) Contribute to the software 2) Report issues or problems with the software 3) Seek support

The documentation does include several pages with contribution instructions. However, the second and third items are not covered. I'd suggest adding links and explanations of these two items in the contributing instructions and on the README.

Affected Page

https://eertmans.be/manim-slides/contributing/index.html

Issue Type

Documentation Enhancement

Recommended fix or suggestions

No response

[FEATURE] toggle mouse display with key

Description

Currently, it is not possible to hide or show the mouse during the presentation.

This would be a nice feature to add.

Screenshots

No response

Additional information

A key, e.g. HIDE_MOUSE: Key = Key(ids[Qt.Key_H], name="HIDE / SHOW MOUSE") shoud be created in manim_slides/config.py.

Then, the App.keyPressEvent method in manim_slides/config.py should be modified to listen to config.HIDE_MOUSE.match(key) and toggle on / off the blank key.

Note that the config argument must, therefore, also be saved in App and that some kind of state must be kept about whether the mouse is hidden or not.

[BUG] Next/Previous Slide does not work with left/right keys

Description

When I tried to use the provided examples, I can't use the left/right keys to jump to the next/previous slide.

Version

manim-slides, version 4.1.1

Platform

macOS, M1 chip

Screenshots

No response

Additional information

No response

[BUG/FEATURE] Slides are not properly resized with the browser frame

Hello! First of all, thanks for this awesome plugin, I am using Manim lately and being able to use them for interactive presentations is a nice addition. However, I found a little inconvenience.

Context

I usually design my animations for a 1920x1080 resolution for obvious reasons, since it is the most widely used aspect-ratio. But some days ago I used a presentation made with manim + manim-slides in a projector, the typical projector found in classrooms. It had a 4:3 old aspect-ratio. Then, I found that the sides of the animation were cropped, and I had to resize the browser manually.

Explanation

If the aspect-ratio of the browser doesn't match the aspect-ratio of the manim video files, the slides are cropped. This is because videos are inserted as RevealJS backgrounds. And by default, RevealJS backgrounds are in 'cover' mode, which scales the background until all the frame is covered. It should be in 'contain', which scales the background until all of it is visible:

How it is currently working

b

How it should work

a

Solution

In the RevealJS documentation, they show how to configure this background-size: https://revealjs.com/backgrounds/. Both for images and videos, it is set by the attribute data-background-size (data-background-size='contain'). I changed the attribute manually in a generated slide and it works.

I am sorry, I don't know how to do a Pull Request (I am starting to contribute to opensource projects, I have to learn soon). But I inspected your code, and I think all you have to do is to add data-background-size="contain" to the HTML sections render. In the file main_slides/convert.py:

def get_sections_iter(self) -> Generator[str, None, None]:
    """Generates a sequence of sections, one per slide, that will be included into the html template."""
    for presentation_config in self.presentation_configs:
        for slide_config in presentation_config.slides:
            file = presentation_config.files[slide_config.start_animation]
            file = os.path.join(self.assets_dir, os.path.basename(file))

            # TODO: document this
            # Videos are muted because, otherwise, the first slide never plays correctly.
            # This is due to a restriction in playing audio without the user doing anything.
            # Later, this might be useful to only mute the first video, or to make it optional.
            # Read more about this:
            #   https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#autoplay_and_autoplay_blocking
            if slide_config.is_loop():
                yield f'<section data-background-video="{file}" data-background-video-muted data-background-video-loop></section>'
            else:
                yield f'<section data-background-video="{file}" data-background-video-muted></section>'

It should be something like:

                yield f'<section data-background-size="contain" data-background-video="{file}" data-background-video-muted data-background-video-loop></section>'
            else:
                yield f'<section data-background-size="contain" data-background-video="{file}" data-background-video-muted></section>'

Unless you want to add a parameter to switch from contain to cover. I don't know if there is any particular use case for maintaining 'cover'.

[FEATURE] Export to png / pdf

What

Being able to export the slides as png or pdf will help in the following situations:

  • Issue with the computer managing the presentation, and backup slides must be used
  • Sharing presentations with other people that do not have manim installed

The animations themselves will obviously be lost, but the feature is still relevant in some cases.

How

I'm not familiar with the rendering process used in manim, but I guess looping through the mp4's generated by manim and taking the last image generated in each video, and then combining them, will be sufficient. Alternatively, taking the last state before the call to next_slide() is also sufficient. The images could then be combined in a pdf file, for instance by creating a beamer presentation using LaTeX, and taking each image as one slide.

When looking at the features described in the documentation, I could not find this one, hence this issue.

[BUG] manim-slides is not recognized

Description

"manim-slides" command not working after pip + git install. I'm probably making some silly mistake but I can't seem to figure out why it's not binding in the console. Tried restarting + adding to PATH but still nothing

Version

4.1.1

Platform

Windows

Screenshots

image

Additional information

No response

[BUG] Qt Plugin Cannot be Initialized Error with Anaconda

Please explain the issue you're experiencing (with as much detail as possible):

Hello,
I've unfortunately been getting the same error when trying to run manim-slides of a scene. The error looks like below:
image
I've tried to uninstall my conda distribution, reset my entire Windows PC, and try and install pyqt5-tools separately, yet none have worked. Is this a bug or is there something that I am missing?

Thank you!

P.S. - The files used in this bug were pulled straight from the main page of the repository.

[FEATURE] Add wheel to PyPI and declare dependencies on Manim/ManimGL

Description

From the JOSE review criteria:

Installation instructions: Is there a clearly stated list of dependencies? (Ideally these should be handled with an automated package management solution.)

I think it would be nice to improve the installation experience by declaring the dependency of Manim-slides on ManimCE/ManimGL so that these are installed automatically and with a supported version. Since you want to support both upstream packages, I think you could use an "extra" dependency, similar to your existing dev dependencies. Then the installation instructions could be modified to be python -m pip install manim-slides[manim] or python -m pip install manim-slides[manimgl].

In addition, I think you should provide a wheel package on PyPI. Providing a wheel saves installation time for the user and they are not required to build anything locally when installing. I see you're using build but specifying only --sdist. Is there a particular reason to avoid the wheel files? Especially since this package is pure Python, it will only be one wheel uploaded.

I also suggest that you specify the compatible python_requires (or the equivalent poetry setting) so that Pip can determine whether the Python in the venv is supported. I suggest setting this as a lower bound and not an upper bound so that new Python releases are not limited in the version they can install, unless you know specifically that a particular version is not supported.

Screenshots

No response

Additional information

No response

[FEATURE] Ability to control outside of window would be awesome

I noticed that it is limiting for me that control keys only work when the presentation window is open. Because I'd like to use OBS to add overlays and have only one monitor, I need to be on the OBS window, but then I can't control the presentation.

So an option for global key bindings would be Awesome.

[BUG] --use-template is not working

Description

When the --use-template option is used, the error Option 'template': str type expected is produced.

Example:

manim-slides convert --use-template slides-template.html Test.html
[...]
Error: 1 error(s) occured with configuration options for 'html', see below.
Option 'template': str type expected

Apparently there is a conflict between the type which convert.convert() is receiving in its parameter template, which is of type Path, and the one Pydantic is expecting and validating, which is str.

The problem can be solved by adding these lines at the beginning of convert.convert():

    if template:
        template = str(template)

Version

manim-slides, version 4.13.0

Platform

Linux

Screenshots

No response

Additional information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.