0

Want to create Label with different name using loop. Because later on I want to destroy that particular Label by calling its name.

Here is the code:

from tkinter import *

w = Tk()
w.geometry('300x400')
a = 10


def remove():
    l.destroy()
                 #SUPPOSE I WANT TO DESTROY 5th LABEL.
                 #BY ASSIGNING NAME TO EACH LABEL ITS EASY TO CALL IT AND DESTROY IT


def client_info():
    pass


for i in range(15):
    l = Label(w, text=client_info)
    l.place(x=10, y=a)
    b = Button(w, text='REMOVE', command=remove)
    b.place(x=200, y=a)
    a = a + 25
w.mainloop()
Michael Butscher
  • 10,028
  • 4
  • 24
  • 25

0 Answers0