Aug-20-2023, 04:18 PM
Hello good,
I am trying to add and subtract values from a treeview column.
So far so good, I show a label and it updates if I add another value to the column.
When you remove a value from the column, it is subtracted. Well, it does, but it shows me the minus symbol "-" (-10$) in front of it. Example. And now when I finish eliminating all the values in the column and the treeview runs out of data, the result of the label shows me the last subtraction done.
![[Image: eYzxDH8.png]](https://i.imgur.com/eYzxDH8.png)
![[Image: WVn9GFk.png]](https://i.imgur.com/WVn9GFk.png)
What could I do so that when there is nothing in the treeview it shows 0$? and remove the symbol (minus "-")
I am trying to add and subtract values from a treeview column.
So far so good, I show a label and it updates if I add another value to the column.
When you remove a value from the column, it is subtracted. Well, it does, but it shows me the minus symbol "-" (-10$) in front of it. Example. And now when I finish eliminating all the values in the column and the treeview runs out of data, the result of the label shows me the last subtraction done.
def calcular_total(self): self.suma_total = 0 for item in self.treeview_cesta.get_children(): self.valor = int(self.treeview_cesta.item(item, "values")[3]) # Cambia el índice (1) al número de columna que desees sumar self.suma_total += self.valor self.entry_total_cesta.config(text=self.suma_total)
![[Image: eYzxDH8.png]](https://i.imgur.com/eYzxDH8.png)
![[Image: WVn9GFk.png]](https://i.imgur.com/WVn9GFk.png)
What could I do so that when there is nothing in the treeview it shows 0$? and remove the symbol (minus "-")