title: How to clear a label using tkinter when pressing a button?
body: <p>I am using labels to show a generated password in my tkinter password generator program, but when I change the length of a password from a lower value than before (for example from a length of 20 to 10) the label displaying the password appears to be overwritten - it does not clear. I have searched methods to do this, but I cannot seem to find any. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>from tkinter import *
  from random import *
  import string
  
  root = Tk()
  root.wm_title("Password Generator")
  topFrame = Frame(root)
  topFrame.pack()
  bottomFrame = Frame(root)
  bottomFrame.pack(side=BOTTOM)
  root.geometry("1000x1000")
  
  title = Label(topFrame, text="Length", fg="blue")
  title.grid(row=3,column=5)
  
  var = DoubleVar()
  Slider_1 = Scale(root,orient=HORIZONTAL,length=32*10,from_=0,to=32, variable 
  = var)
  Slider_1.pack()
  passLen = var.get()
  
  uppercaseLetters = "QWERTYUIOPASDFGHJKLZXCVBNM"
  lowercaseLetters = "qwertyuiopasdfghjklzxcvbnm"
  symbols = "!£$%^&amp;*()_+-=}{][~@#':;?&gt;/.&lt;,"
  digits = "1234567890"
  
  def gen():
      characters = uppercaseLetters + lowercaseLetters + symbols + digits
      password = "".join(choice(characters) for x in range(int(var.get())))
      passLabel = Label(topFrame, text=password)
      passLabel.grid(row=4, column=5)
  
      genButton = Button(topFrame, text="Generate Password", fg="blue", 
      command=gen)
      genButton.grid(row=1, column=5)
  
      root.mainloop()
  </code></pre>
  
  <p>When I set the length to 32 characters:</p>
  
  <p><img src="https://i.stack.imgur.com/9CGVx.jpg" alt="screenshot"></p>
  
  <p>And when I set the length to 6 characters it does not clear the old password label - it simply overwrites it in the middle of the old password label:</p>
  
  <p><img src="https://i.stack.imgur.com/PcYWz.jpg" alt="screenshot2"></p>