title: how to make tkinter identify a defined object?
body: <p>The code:</p>
  <pre><code>from tkinter import *
  
  def show (A, B, C, D):
  
      if A == &quot;Large&quot;:
          
          Label1 = Label(root, text=A).pack()
  
      if B == &quot;Medium&quot;:
          
          Label1 = Label(root, text=B).pack()
  
      if C == &quot;Small&quot;:
          
          Label1 = Label(root, text=C).pack()
  
      if D == &quot;Infinitesimal&quot;:
          
          Label1 = Label(root, text=D).pack()
  
  def clear ():
      Label1.destroy()
          
  
  root = Tk()
  root.geometry(&quot;500x500+200+200&quot;)
    
  var1 = StringVar()
  var2 = StringVar()
  var3 = StringVar()
  var4 = StringVar()
  
  a =Checkbutton(root, text=&quot;Large?&quot;, variable=var1, onvalue=&quot;Large&quot;)
  a.deselect()
  a.pack()
  
  b =Checkbutton(root, text=&quot;Medium?&quot;, variable=var2, onvalue=&quot;Medium&quot;)
  b.deselect()
  b.pack()
  
  c =Checkbutton(root, text=&quot;Small?&quot;, variable=var3, onvalue=&quot;Small&quot;)
  c.deselect()
  c.pack()
  
  d =Checkbutton(root, text=&quot;Infinitesimal?&quot;, variable=var4, onvalue=&quot;Infinitesimal&quot;)
  d.deselect()
  d.pack()
  
  W = Button(root, text=&quot;Submit&quot;, command=lambda: show(var1.get(), var2.get(), var3.get(), var4.get(), )).pack()
  
  x = Button(root, text=&quot;Clear&quot;, command=clear).pack()
  
  root.mainloop()
  </code></pre>
  <p>The initial checked list of items will post, but, then, suppose one wants to clear the screen using the clear button.  That's when I run into the following error.</p>
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File &quot;C:\Users\lib\tkinter\__init__.py&quot;, line 1705, in __call__
      return self.func(*args)
    File &quot;&lt;ipython-input-55-b81bc2ffe1d0&gt;&quot;, line 22, in clear
      Label1.destroy()
  NameError: name 'Label1' is not defined
  </code></pre>
  <p>My concern isnt so much in just fixing this one script, but I am interested in understanding what I did wrong and how to handle this type of error.</p>
  <p>why is not the computer identifying 'Label1' as defined?</p>