I am new to Python and I can’t resolve this error, I don´t understand what it means because it is not explicit.
I am not placing the entire code, only the function that is throwing an error.
el_id = 0
compra = {}
def funcion_baja():
global el_id
global compra
item = tree.focus()
tag = tree.item(item)
if tag in compra[el_id]:
del compra[tag]
tree.delete(item)
else:
print(“Record not found.”)
I was trying to find a record in the treeview and delete it from the treeview and from the dictionary, by selecting it and using the ID I created for it (el_id) in the dictionary. each new record will have a distinct ID so it should let me choose it. I don’t know why but I keep getting an error here:
enter image description here
Patricia Bartoloni is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.