class_docstr: The foundation of all animations.
  
  Parameters
  ----------
  blocks : list of animatplot.animations.Block
      A list of blocks to be animated
  timeline : Timeline or 1D array, optional
      If an array is passed in, it will be converted to a Timeline.
      If not given, a timeline will be created using the length of the
      first block.
  fig : matplotlib figure, optional
      The figure that the animation is to occur on
  
  Attributes
  ----------
  animation
      a matplotlib animation returned from FuncAnimation
class_docstr_tok: ["The","foundation","of","all","animations",".","Parameters","--","--","--","--","--","blocks",":","list","of","animatplot.animations.Block","A","list","of","blocks","to","be","animated","timeline",":","Timeline","or","1D","array",",","optional","If","an","array","is","passed","in",",","it","will","be","converted","to","a","Timeline",".","If","not","given",",","a","timeline","will","be","created","using","the","length","of","the","first","block",".","fig",":","matplotlib","figure",",","optional","The","figure","that","the","animation","is","to","occur","on","Attributes","--","--","--","--","--","animation","a","matplotlib","animation","returned","from","FuncAnimation"]
docstr: Creates a play/pause button to start/stop the animation
  
  Parameters
  ----------
  ax : matplotlib.axes.Axes, optional
      The matplotlib axes to attach the button to.
docstr_tok: ["Creates","a","play\/pause","button","to","start\/stop","the","animation","Parameters","--","--","--","--","--","ax",":","matplotlib.axes.Axes",",","optional","The","matplotlib","axes","to","attach","the","button","to","."]
code: def toggle(self, ax=None):
      """Creates a play/pause button to start/stop the animation
  
      Parameters
      ----------
      ax : matplotlib.axes.Axes, optional
          The matplotlib axes to attach the button to.
      """
      if ax is None:
          adjust_plot = {"bottom": 0.2}
          rect = [0.78, 0.03, 0.1, 0.07]
  
          plt.subplots_adjust(**adjust_plot)
          self.button_ax = plt.axes(rect)
      else:
          self.button_ax = ax
  
      self.button = Button(self.button_ax, "Pause")
      self.button.label2 = self.button_ax.text(
          0.5,
          0.5,
          "Play",
          verticalalignment="center",
          horizontalalignment="center",
          transform=self.button_ax.transAxes,
      )
      self.button.label2.set_visible(False)
  
      def pause(event):
          if self._pause:
              self.animation.event_source.start()
              self.button.label.set_visible(True)
              self.button.label2.set_visible(False)
          else:
              self.animation.event_source.stop()
              self.button.label.set_visible(False)
              self.button.label2.set_visible(True)
          self.fig.canvas.draw()
          self._pause ^= True
  
      self.button.on_clicked(pause)
  
file_path: animatplot/animatplot/animation.py
imports: from matplotlib.animation import FuncAnimation, PillowWriter
  from matplotlib.widgets import Button, Slider
  import matplotlib.pyplot
  import numpy
  from animatplot import Timeline
label_desc: Use image node_id 2 for calling the Animation obj's underlying member method code with example usage: obj.toggle(ax) without return types