title: Python Tkinter Label redrawing every 10 seconds
body: <p>I have this following Python Tkinter code which redraw the label every 10 second. My question is , to me it seems like it is drawing the new label over and over again over the old label. So, eventually, after a few hours there will be hundreds of drawing overlapping (at least from what i understand). Will this use more memory or cause problem?</p>
  
  <pre><code>import Tkinter as tk
  import threading
  
  def Draw():
      frame=tk.Frame(root,width=100,height=100,relief='solid',bd=1)
      frame.place(x=10,y=10)
      text=tk.Label(frame,text='HELLO')
      text.pack()
  
  def Refresher():
      print 'refreshing'
      Draw()
      threading.Timer(10, Refresher).start()
  
  root=tk.Tk()
  Refresher()
  root.mainloop()
  </code></pre>
  
  <p>Here in my example, i am just using a single label.I am aware that i can use <code>textvariable</code> to update the text of the label or even <code>text.config</code>. But what am actually doing is to refresh a grid of label(like a table)+buttons and stuffs to match with the latest data available.</p>
  
  <p>From my beginner understanding, if i wrote this <code>Draw()</code> function as class, i can destroy the <code>frame</code> by using <code>frame.destroy</code> whenever i execute <code>Refresher</code> function. But the code i currently have is written in functions without class ( i don't wish to rewrite the whole code into class).</p>
  
  <p>The other option i can think of is to declare <code>frame</code> in the <code>Draw()</code> as global  and use <code>frame.destroy()</code> ( which i reluctant to do as this could cause name conflict if i have too many frames (which i do))</p>
  
  <p>If overdrawing over the old drawing doesn't cause any problem (except that i can't see the old drawing), i can live with that.</p>
  
  <p>These are all just my beginner thoughts. Should i destroy the frame before redraw the updated one? if so, in what way should i destroy it if the code structure is just like in my sample code? Or overdrawing the old label is fine?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Someone mentioned that python tkinter is not thread safe and my code will likely to fail randomly.  </p>
  
  <p>I actually took <a href="https://stackoverflow.com/questions/2223157/how-to-execute-a-function-asynchronously-every-60-seconds-in-python">this link</a> as a reference to use <code>threading</code> as my solution and i didn't find anything about thread safety in that post.</p>
  
  <p>I am wondering what are the general cases that i should not use <code>threading</code> and what are the general cases i could use <code>threading</code>?</p>