Python Forum
How to delete tkinter table items?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to delete tkinter table items?
#1
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?
Reply
#2
What is the type of self.table ? Surely that type is documented somewhere.
« We can solve any problem by introducing an extra level of indirection »
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] modify the html table to include data from tkinter labels rwahdan 0 1,702 Jun-20-2021, 10:33 AM
Last Post: rwahdan
  [Tkinter] Tkinter delete values in Entries, when I'm changing the Frame robertoCarlos 11 6,291 Jul-29-2020, 07:13 PM
Last Post: deanhystad
  [Tkinter] Tkinter delete combobox content and not the list LagratteCchouette 4 8,799 Dec-29-2019, 11:04 AM
Last Post: LagratteCchouette
  Tkinter Generate/Delete Shapes with Keyboard Events baseball2201 3 3,793 Aug-16-2019, 12:23 PM
Last Post: Larz60+
  How to delete text from a tkinter Text widget? Tang 1 28,893 May-20-2018, 09:26 PM
Last Post: Larz60+
  type farsi in the sql table tkinter gray 1 3,571 Feb-24-2017, 06:50 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020