title: How can I check if a frame exists and - if so - destroy it?
body: <p>I am trying to pull some lines of text from a txt file online and show them in a window. So far, so good.</p>
  
  <p>I want to reload/refresh that window every 'x' seconds so that the labels in it are redrawn (in case I've added, subtracted or changed the lines of text in that txt file), but couldn't do it so far.</p>
  
  <p>I have added a Frame to the root and dynamically added the Labels to the Frame.
  Every 'x' seconds, I want to check if that frame exists and - if so - destroy it, pull the content of the txt file again and recreate the frame and labels so that my labels are up to date.</p>
  
  <p>For that, I've tried adding a 'Try/Except' at the begining of my function to check if the frame exists and destroy it, but I couldn't get it to work.</p>
  
  <p>Any ideas that can help a very inexperienced python enthusiast?</p>
  
  <pre><code>#coding:utf-8
  
  from Tkinter import *
  import urllib
  import time
  
  mroot = Tk()
  
  def mactions():
      mconteudo = urllib.urlopen('http://www.xyz.com.br/recados.txt')
      mtexto = mconteudo.read().split('***')
  
      #this is where I think I'm doing something wrong - I always get a NameError.
      try:
          mframe.destroy()
      except NameError:
          print '- NameError -'
      except UnboundLocalError:
          print '- UnboundLocalError -'
  
      mframe = Frame(mroot)
      for i in mtexto:
          w = Label(mframe, text=i)
          w.pack()
          wseparador = Label(mframe, text='________')
          wseparador.pack()
          mframe.pack()
  
      mroot.after(2000, mactions)
  
  mactions()
  mroot.mainloop()
  </code></pre>