Styling our record list with tags

Although Treeview is a Ttk widget, it uses tags to control the styling of individual rows. We can use this to answer another of the requests you've gotten from the data entry staff: they'd like the record list to highlight records updated and inserted during the current session.

The first thing we'll need to do is have our Application object keep track of which rows have been updated or inserted during the session.

In Application.__init__(), we'll create the following instance variables:

        self.inserted_rows = []
        self.updated_rows = []

When a record is saved, we'll need to update one or the other of these lists with its row number. We'll do this in Application.on_save(), after the record is saved, but before ...

Get Python GUI Programming with Tkinter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.