title: Tkinter understanding after()
body: <p>First of all, take a look at my previous thread here: <a href="https://stackoverflow.com/questions/29158220/tkinter-understanding-mainloop">Tkinter understanding mainloop</a></p>
  
  <p>After following the advice from there, in GUI programming, infinite loops have to be avoided at all costs, in order to keep the widgets responsive to user input.</p>
  
  <p>Instead of using:</p>
  
  <pre><code>while 1:
      ball.draw()
      root.update()
      time.sleep(0.01)
  </code></pre>
  
  <p>I managed using <code>self.canvas.after(1, self.draw)</code> inside my <code>draw()</code> function.</p>
  
  <p>So my code now looks like this:</p>
  
  <pre><code># Testing skills in game programming
  
  from Tkinter import *
  
  root = Tk()
  root.title("Python game testing")
  root.resizable(0, 0)
  root.wm_attributes("-topmost", 1)
  
  canvas = Canvas(root, width=500, height=400, bd=0, highlightthickness=0)
  canvas.pack()
  root.update()
  
  class Ball:
      def __init__(self, canvas, color):
          self.canvas = canvas
          self.id = canvas.create_oval(10, 10, 25, 25, fill=color)
          self.canvas.move(self.id, 245, 100)
  
          self.canvas_height = canvas.winfo_height()
          self.x = 0
          self.y = -1
  
      def draw(self):
          self.canvas.move(self.id, self.x, self.y)
  
          pos = self.canvas.coords(self.id)
          if pos[1] &lt;= 0:
              self.y = 1
          if pos[3] &gt;= self.canvas_height:
              self.y = -1
  
          self.canvas.after(2, self.draw)
  
  
  ball = Ball(canvas, "red")
  ball.draw()
  
  root.mainloop()
  </code></pre>
  
  <p>However, time inside <code>self.canvas.after()</code> does not work properly...
  If set to 1 it's extremely fast! If it's set to 10, 5 or even 2, it's too slow!
  I didn't have that problem while using the above while loop in my code since the <code>time.sleep()</code> worked as it should!</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I can now report that the time inside the after function of Tkinter does not work properly in my Windows 8.1 tablet, and in my Windows 8.1 laptop, while in the same laptop when running Ubuntu through <em>virtual machine</em> it does work as it should.</p>