title: How to import a matplotlib 3D animation in a tkinter frame in python?
body: <p>I'm trying to import a matplotlib 3D animation inside a Tkinter window but I got stuck on an error. My Tkinter window has many frames and I try to plot the animation on one of this frame. Finally, I create all elements inside a class init function. So here is a simplified version of my code:</p>
  
  <pre><code>from tkinter import *
  import matplotlib
  matplotlib.use("TkAgg")
  from matplotlib.backends.backend_tkagg import  FigureCanvasTkAgg
  from matplotlib.figure import Figure
  from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.animation as anim
  import random
  
  class UI:
      def __init__(self):
          self.back = Frame(master=self.window, width=1200, height=800, bg='white')
          self.rightBack = Frame(master=self.back, width=300, height=800)
          self.rightBack.pack(side='right',padx=2,pady=2)
          self.fig = Figure()
          self.axes = Axes3D(self.fig)
  
          self.ani = anim.FuncAnimation(self.fig, self.updateDisplay, interval=100, blit=False) #  Creating animation
  
          self.canvas = FigureCanvasTkAgg(self.fig, master=self.displayBack)
          self.canvas.get_tk_widget().pack(side=TOP,fill=BOTH,expand=True)
  
  
          # Starting application
          self.window.mainloop()
  
      def updateDisplay(self,num):
          self.axes.clear()
          self.axes.plot([0,1,random.random()],[0,1,random.random()],[0,1,random.random()],'o',color='k',markersize='5')
  </code></pre>
  
  <p>But when I run the following in python</p>
  
  <pre><code>self.ani = anim.FuncAnimation(self.fig, self.updateDisplay, interval=100, blit=False)
  </code></pre>
  
  <p>I get this error</p>
  
  <pre><code>File "matplotlib/animation.py", line 1703, in __init__
  TimedAnimation.__init__(self, fig, **kwargs)
  
  File "matplotlib/animation.py", line 1465, in __init__
  event_source = fig.canvas.new_timer()
  
  AttributeError: 'NoneType' object has no attribute 'new_timer'
  </code></pre>
  
  <p>So I think I understood the error as animation needs a timer but I don't know how to fix it.  Any help? Thank's in advance</p>