So in shorcut my code is making a changeable amount of Entry’s and Labels.
There is a part of this code that is important.
for i in range(10):
for z in range(5):
entry_dict = {}
entry_dict[f'grid-{i}-{z}'] = [f'grid-{i}-{z}']
fake_label = {}
fake_label[f'grid-{i}-{z}'] = [f'grid-{i}-{z}']
if z == 0:
random_tran = random.choice(tran_pre)
entry_dict[f'grid-{i}-{z}'] = ctk.CTkEntry(data, textvariable=var_num[f'transaction_{i}'],
height=60, width = 90, bg_color = 'grey18')
fake_label[f'grid-{i}-{z}'] = ctk.CTkLabel(data, text = random_tran, height=60, width = 90,
bg_color = 'grey18')
fake_label[f'grid-{i}-{z}'].bind('<Button>', lambda event: disapear(fake_label[f'grid-{i}-{z}']))
entry_dict[f'grid-{i}-{z}'].place(x=iks, y=igrek)
fake_label[f'grid-{i}-{z}'].place(x=iks, y=igrek)
iks = iks + 95
Im using a dict to set their names and everything works fine until i wont Labels to be deleted when clicked. Its this line of code
fake_label[f'grid-{i}-{z}'].bind('<Button>', lambda event: disapear(fake_label[f'grid-{i}-{z}']))
def disapear(Widget_):
Widget_.destroy()
But i got en error here:
AttributeError: ‘list’ object has no attribute ‘destroy’
I dont understand why i can use ‘place’ function with a dict named label, but cant forget it or destroy? and why a list is named in error while im using a dict?
I tried using normal lambda, forget_palce function but i got no idea why this is even happening.
Thanks for any help in advance.