title: Print a changing variable in Python Zelle graphics window
body: <p>I have created a window using Zelle graphics in Python and want to print the value of a variable which changes after every iteration. Here is my code:</p>
  
  <pre><code>from graphics import *
  import random
  from time import sleep
  
  def myWindow(dim,Array,win):
  
  
      for j in range (dim):
          rec = Rectangle(Point(5+j, 10), Point(6 + j, 11))
          rec.setFill("white")
          rec.draw(win)    
          Array.append(rec)
  
      label = "Dimension =", dim
      text = Text(Point(10,8), label)
      text.draw(win) 
  
  
  def main():
      dim = 10
      Array = []
      win = GraphWin("Game of Life", 400, 400)
      win. setCoords(0, 0, 20, 20)
  
      myWindow(dim,Array,win)
  
  
      for i in range (10):
          sleep(1)
          dim = dim - i - 1
          Array[i].setFill("Black")
  
      sleep(5)    
  
  main() 
  </code></pre>
  
  <p>You can see that the array colour changes after every iteration and the dimension (variable <code>dim</code> in my code) of the array is being reduced by one unit. Now I want to print the correct dimension in the window.</p>
  
  <p>My code does not change the value of dimension in the graphics window, though the colour changes after each iteration.</p>
  
  <p>Why is the displayed value of the variable <code>dim</code> not changing? How do I achieve this? </p>