title: Error 'NoneType' object is not callable from FuncAnimation inside a new class in Python?
body: <p>I am trying to create a new class to create plots with some pre-defined parameters of matplolib, so the process of creating a plot will be a little easier for what I am trying to create. So, basically I've got the following code:</p>
  <pre><code>import tkinter as tk
  import matplotlib
  import matplotlib.animation as animation
  from matplotlib.figure import Figure
  from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
  from matplotlib import style
  
  style.use('ggplot')
  matplotlib.use(&quot;TkAgg&quot;)
  
  
  class Plotting():
      def __init__(self, parent, file):
  
          self.parent = parent
  
          self.fig = Figure()
          self.figax1 = self.fig.add_subplot(111)
  
          self.canvas = FigureCanvasTkAgg(self.fig, self.parent)
          self.canvas.draw()
          self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
  
          self.ani = animation.FuncAnimation(self.fig, self.getData(file))
  
      def getData(self, file):
  
          self.file = file
  
          self.graphData = open(self.file).read()
          self.lines = self.graphData.split('\n')
  
          self.x1 = []
          self.y1 = []
  
          for line in self.lines:
              if len(line) &gt; 1:
                  self.x, self.y = line.split(',')
                  self.x1.append(float(self.x))
                  self.y1.append(float(self.y))
  
          self.figax1.clear()
          self.figax1.plot(self.x1, self.y1)
  
  
  if __name__ == &quot;__main__&quot;:
      root = tk.Tk()
      frame1 = tk.Frame(root)
      frame1.pack()
      plot1 = Plotting(frame1, 'samplefile.txt')
      root.mainloop()
  </code></pre>
  <p>After running this, and having the sample file made of random numbers separated by ,<br />
  It create the Plot, but I've got several errors related to the FuncAnimation function.</p>
  <p>Error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:\...\Python38-32\lib\site-packages\matplotlib\cbook\__init__.py&quot;, line 196, in process
      func(*args, **kwargs)
    File &quot;C:\...\Python38-32\lib\site-packages\matplotlib\animation.py&quot;, line 951, in _start
      self._init_draw()
    File &quot;C:\...\Python38-32\lib\site-packages\matplotlib\animation.py&quot;, line 1743, in _init_draw
      self._draw_frame(next(self.new_frame_seq()))
    File &quot;C:\...\Python38-32\lib\site-packages\matplotlib\animation.py&quot;, line 1766, in _draw_frame
      self._drawn_artists = self._func(framedata, *self._args)
  TypeError: 'NoneType' object is not callable
  </code></pre>