[Python] Treeview table showing duplicates from list of lists

Discussão em 'Python' iniciado por Stack, Março 20, 2025.

  1. Stack

    Stack Membro Participativo

    For a program that takes information from the network I would like to display it in a table to make selections (calculate average, stdev ect.). I created a list of lists and I am trying to populate it into a treeview table. The table should show serial number, the parameters requested and their respected values. The populating works, but I get 3 duplicates of every row and the final row per serialnumber shows 7 duplicates (while my list of lists only shows 1 result per line).

    I've been struggling for some time to remove the duplicates and checked the suggestions here. Behind the '#' in the code below are the suggestions I found. Behind the '->' I mention the result.

    def displayInfo():
    #tree.delete(*tree.get_children()) -> Shows no improvement at all
    for results in fullResults:
    # tree.delete(0, "end") -> doesn't run as it doesn't recognise command
    # tree.delete(*tree.get_children()) -> Shows no improvement at all
    for result in results:
    # tree.delete(*tree.get_children()) -> deletes the previous serialnumber
    for value in result:
    tree.insert('', 'end', values=result)


    Can you please point me to some direction?

    Continue reading...

Compartilhe esta Página