title: How to attach delete function in Tkinter GUI
body: <p>I am new to python &amp; requesting help from experts in this community. I am trying to delete images from my Tkinter widget FrameLabel. I have followed many solutions provided on the StackOverflow, but unfortunately, I am unable to implement those solutions in my code. I need help in deleting the image I have uploaded on the window. </p>
  
  <hr>
  
  <p><strong>GUI working</strong>: </p>
  
  <ul>
  <li>Click on Select</li>
  <li>Browse the image</li>
  <li>Upload the image</li>
  <li>It will display in the LabelFrame shown as following:
  
  <pre><code>frame3 = tk.LabelFrame(pw_right, bd=2, text='Uploaded images')
  frame3.pack(side='left', anchor='nw')
  </code></pre></li>
  </ul>
  
  <hr>
  
  <p>Delete Button</p>
  
  <pre><code>DelButton = tk.Button(frame1, text ='Delete', command = button.on_click_del_button)
  DelButton.grid(row=0, column=4)
  </code></pre>
  
  <p>Delete Function:</p>
  
  <pre><code>def on_click_del_button(self):
      print('Delete button clicked')
  
      image = self.paths[self.radio_var.get()]
  
      if os.path.exists(image):
          os.remove(image)
      else:
          print("The file does not exist")
  </code></pre>
  
  <p><strong>Help required section</strong>: I need help in defining Delete Function i.e <strong><em>button.on_click_del_button</em></strong>
  so that when I press delete. Tkinter deletes the selected image from the window.</p>
  
  <p>Below is the GUI for the window:
  <a href="https://i.stack.imgur.com/nJrMv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nJrMv.jpg" alt="enter image description here"></a></p>
  
  <p>I followed the suggestion followed by expert furas, But nothing is happening in the Tkinter window. Although all the print values are being displayed.</p>
  
  <p><a href="https://i.stack.imgur.com/qpdCz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qpdCz.jpg" alt="enter image description here"></a></p>