title: AttributeError: 'int' object has no attribute 'tk'
body: <p>I'm essentially trying to continuously update a graph embedded in a tkinter GUI window and am using the <strong>after</strong> function to call the update function after a specified time (10 ms). I get the above error as the callback is executed, however, and I am quite new to tkinter and Python OOP so I could very well be making a basic error. Here's the code (error happens in def update_plot):</p>
  
  <pre><code>class PageThree(tk.Frame):    
      def __init__(self, parent, controller):
          tk.Frame.__init__(self, parent)
          label = tk.Label(self, text="Graph Page!", font=LARGE_FONT)
          label.pack(pady=10,padx=10)
  
          button1 = ttk.Button(self, text="Back to Home",
                               command=lambda: controller.show_frame(StartPage))
          button1.pack()
          global f, a
          f = Figure(figsize=(5,5), dpi=100)
          a = f.add_subplot(111)
  
          canvas = FigureCanvasTkAgg(f, self)
          canvas.show()
          canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
  
          toolbar = NavigationToolbar2TkAgg(canvas, self)
          toolbar.update()
          canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
  
          readbutton = ttk.Button(self, text="Start Data Collection", command=self.read_data)
          readbutton.pack()
  
          stopbutton = ttk.Button(self, text="Stop Data Collection",
                       command=self.stop_data)
          stopbutton.pack()
  
      def read_data(self):
          t_axis = []
          global starttime
          starttime = time()
          self.update_plot()
  
      def update_plot(self):
          global func_id
          t_axis.append(time()-starttime)
          output.append(random.random())
          a.cla()
          a.plot(t_axis, output)
          func_id = tk.Tk.after(samplerate, self.update_plot) # this is where it runs into an error
  
      def stop_data(self):
          global func_id
          tk.Tk.after_cancel(func_id)
  </code></pre>
  
  <p>Full traceback error is:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "/Users/.../anaconda/lib/python3.5/tkinter/__init__.py", line 1550, in __call__
      return self.func(*args)
    File "./gui2.py", line 202, in read_data
      self.update_plot()
    File "./gui2.py", line 211, in update_plot
      func_id = tk.Tk.after(samplerate, self.update_plot)
    File "/Users/.../anaconda/lib/python3.5/tkinter/__init__.py", line 592, in after
      self.tk.call('after', ms)
  AttributeError: 'int' object has no attribute 'tk'
  </code></pre>
  
  <p>I'm pretty stumped on this one and haven't found any questions like it elsewhere. Any pointers?</p>