title: How to delete and recreate a canvas ? (TKINTER / CANVAS )
body: <p>I have search for hours on the net how to delete and next recreate a &quot;canvas&quot; on Tkinter.</p>
  <p>So first my code :</p>
  <pre><code>import tkinter as tk
  import time
  import numpy as np
  m = 100
  matrice = np.zeros((m,m))
  matrice[10][10] = 1
  
  root = tk.Tk()
  root.title(&quot;Test&quot;)
  root.geometry('1200x800')
  canvas = tk.Canvas(width = 700 , height = 700)
  
  def trace(m) :
      global canvas
      m2 = int(700/m)
      canvas.destroy()
      canvas = tk.Canvas(width = 700 , height = 700)
      for i in range(0,m) :
          for j in range(0,m) : 
              x = m2*i
              y = m2*j
              canvas.create_rectangle(x , y , m2+x , m2+y,outline = 'grey' , width = 1)
  
  def affiche_points(m,matrice) :
      global canvas
      m2 = int(700/m)
      for i in range(m):
          for j in range(m):
              if matrice[i][j] == 1 :
                  x = m2*i
                  y = m2*j
                  canvas.create_rectangle(x , y , m2+x , m2+y , fill = 'black')
  
  
  def actualisation(m,matrice) :
      global canvas
      trace(m)
      affiche_points(m,matrice)
      canvas.pack()
  
  
  actualisation(m,matrice)
  
  for i in range(0,20) :
  
      matrice = np.zeros((m,m)) 
      matrice[i][10] = 1
      actualisation(m,matrice)
      time.sleep(0.5) 
  
  
  
  root.mainloop()
  </code></pre>
  <p>I just want to create a grid and when an element in the matrix changes the grid changes too (0 = white and 1  = black)
  In my case i use</p>
  <pre><code>canvas.destroy()
  </code></pre>
  <p>to clear the window</p>
  <p>and i wait 0.5 seconds with time.sleep() until i show the new image from the matrix</p>
  <p>My problem is that i can't see the actualization :(</p>
  <p>I just see the last frame !
  I don't know if it is the canvas.pack() or something like that which can not be refreshed.</p>
  <p>NB : This is a simplification for a bigger plan !</p>
  <p>NB 2 : Sorry for my weird english i'm french you know...</p>
  <p>THANK YOU</p>