Skip to content

feat(animation): add start_paused option to Animation - #32204

Open
Muhtasim-Munif-Fahim wants to merge 1 commit into
matplotlib:mainfrom
Muhtasim-Munif-Fahim:feat/animation-start-paused
Open

feat(animation): add start_paused option to Animation#32204
Muhtasim-Munif-Fahim wants to merge 1 commit into
matplotlib:mainfrom
Muhtasim-Munif-Fahim:feat/animation-start-paused

Conversation

@Muhtasim-Munif-Fahim

Copy link
Copy Markdown

Problem

Closes #31883. Animations created with \FuncAnimation\ start playing immediately when the figure renders. There is no supported way to begin an animation in a paused state, forcing users to either attach callbacks or override internals.

Solution

Adds a \start_paused\ parameter (default \False) to \Animation.init. When \True, the first frame is drawn but the event source is not started, so the animation stays paused until .resume()\ is called.

Implementation

  • Stores \self._start_paused\ on init
  • In _start(), when paused: perform the initial draw but skip \event_source.start()\

Tests

Added \ est_animation_start_paused\ covering:

  • \start_paused=True: \event_source.start()\ not called during _start()\
  • Default \False: start() called
  • \start_paused=True\ then
    esume(): start() called exactly once

All pass:

\
python -m pytest lib/matplotlib/tests/test_animation.py -k paused -v
\\

Risks

Backward compatible (default \False). Works for FuncAnimation and subclasses.

@melissawm melissawm added ai-contribution PRs that are AI generated without a human in the loop status: autoclose candidate PRs that are not yet ready for review and may be automatically closed in two weeks labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown

⏰ This pull request might be automatically closed in two weeks from now.

Thank you for your contribution to Matplotlib and for the effort you have put into this PR. This pull request does not yet meet the quality and clarity standards needed for an effective review. Project maintainers have limited time for code reviews, and our goal is to prioritize well-prepared contributions to keep Matplotlib maintainable.

Matplotlib maintainers cannot provide one-to-one guidance on this PR. However, if you ask focused, well-researched questions, a community member may be willing to help. 💬

To increase the chance of a productive review:

As the author, you are responsible for driving this PR, which entails doing necessary background research as well as presenting its context and your thought process. If you are a new contributor, or do not know how to fulfill these requirements, we recommend that you familiarize yourself with Matplotlib's development conventions or engage with the community via our Discourse or one of our meetings before submitting code.

If you substantially improve this PR within two weeks, leave a comment and a team member may remove the status: autoclose candidate label and the PR stays open. Cosmetic changes or incomplete fixes will not be sufficient. Maintainers will assess improvements on their own schedule. Please do not ping (@) maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-contribution PRs that are AI generated without a human in the loop status: autoclose candidate PRs that are not yet ready for review and may be automatically closed in two weeks topic: animation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH]: Start Animation in a paused state

2 participants