Repository: ManimCommunity/manim
File: manim/scene/scene.py (Python)

Code before:
        ----------

        args
            Animations to be played.
        subcaption
            The content of the external subcaption that should
            be added during the animation.
        subcaption_duration
            The duration for which the specified subcaption is
            added. If ``None`` (the default), the run time of the
            animation is taken.
        subcaption_offset
            An offset (in seconds) for the start time of the
            added subcaption.
        kwargs
            All other keywords are passed to the renderer.

        """
        # Make sure this is running on the main thread
        if threading.current_thread().name != "MainThread":
            self.queue.put(
                (
                    "play",
                    args,
                    kwargs
                    | {
                        "subcaption": subcaption,
                        "subcaption_duration": subcaption_duration,
                        "subcaption_offset": subcaption_offset,
                    },
                )
            )
            return

        start_time = self.renderer.time
        self.renderer.play(self, *args, **kwargs)
        run_time = self.renderer.time - start_time
        if subcaption:
            if subcaption_duration is None:
                subcaption_duration = run_time
            # The start of the subcaption needs to be offset by the
            # run_time of the animation because it is added after
            # the animation has already been played (and Scene.renderer.time
            # has already been updated).
            self.add_subcaption(
                content=subcaption,
                duration=subcaption_duration,
                offset=-run_time + subcaption_offset,
            )

    def wait(

Review comment (bug):
I think it would be better to use the conventional update method for dicts, the `|` syntax was only introduced with like Python 3.9 and up, no? Without a corresponding `__future__` import, this will break Manim on Python 3.7 + 3.8.

Code after:
        ----------

        args
            Animations to be played.
        subcaption
            The content of the external subcaption that should
            be added during the animation.
        subcaption_duration
            The duration for which the specified subcaption is
            added. If ``None`` (the default), the run time of the
            animation is taken.
        subcaption_offset
            An offset (in seconds) for the start time of the
            added subcaption.
        kwargs
            All other keywords are passed to the renderer.

        """
        # Make sure this is running on the main thread
        if threading.current_thread().name != "MainThread":
            kwargs.update(
                {
                    "subcaption": subcaption,
                    "subcaption_duration": subcaption_duration,
                    "subcaption_offset": subcaption_offset,
                }
            )
            self.queue.put(
                (
                    "play",
                    args,
                    kwargs,
                )
            )
            return

        start_time = self.renderer.time
        self.renderer.play(self, *args, **kwargs)
        run_time = self.renderer.time - start_time
        if subcaption:
            if subcaption_duration is None:
                subcaption_duration = run_time
            # The start of the subcaption needs to be offset by the
            # run_time of the animation because it is added after
            # the animation has already been played (and Scene.renderer.time
            # has already been updated).
            self.add_subcaption(
                content=subcaption,
                duration=subcaption_duration,
                offset=-run_time + subcaption_offset,
            )