O'Reilly logo

Python GUI Programming with Tkinter by Alan D. Moore

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required