title: Python Tkinter - hide a widget after some time
body: <p>I want to draw a widget (in this example, a canvas) and then remove it after some time. Like a message that shows up and then is removed, just so that the user can read it, but there is no need to click "ok" or something like that to remove the message.</p>
  
  <p>Here is an example code. </p>
  
  <pre><code>from tkinter import*
  
  root = Tk()
  
  canvas_1 = Canvas(root, width = 300, height = 300, bg = 'white')
  canvas_1.grid(column = 0, row = 0)
  
  canvas_2 = Canvas(canvas_1, width = 200, height = 200, bg = 'blue')
  canvas_2.place(x = 50, y = 50)
  
  canvas_1.after(1000, canvas_2.place_forget())
  
  root.mainloop()
  </code></pre>
  
  <p>The problem is that it seems tkinter runs the <code>after()</code> method before everything else, no matter when it is called in the code. The result is that the <code>canvas_2</code> never appears.</p>
  
  <p>I've tried <code>time.sleep()</code> but it seems to work in the same way in this case.</p>
  
  <p>Thanks in advance.</p>