Python Forum

Full Version: How to delete tkinter table items?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a window that is live updating with rows, but it only adds rows. I'd like to delete the old rows each refresh so that it appears as a live table. Heres what I have so far:

 filename = 'exampleFile.csv'
        
        #this keeps adding rows; need to delete rows at end of cycle
        while(1):
            with open(filename, 'r') as file:
                reader = csv.reader(file)
                for row in reader:
                    ##value = row
                    #this adds the rows, need to delete afterwards
                    self.table.addItem(f'among ', f'{row}')
                    
                time.sleep(1)
             

            self.update()
            time.sleep(1)
            file.close()
I've tried "del row" but that obviously just deletes the rows from the reader object instead of deleting the items from the table. There doesn't seem to be a clean way to remove items from the table?
What is the type of self.table ? Surely that type is documented somewhere.