From the course: Python GUI Development with Tkinter

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Adding columns and selecting items in the Treeview

Adding columns and selecting items in the Treeview

From the course: Python GUI Development with Tkinter

Adding columns and selecting items in the Treeview

- [Instructor] In the previous video we learned how to add and remove items from the hierarchal structure of a treeview. In this video we'll continue from where that example left off to learn how to add additional columns to the treeview which can be used to display information about the tree's items. We'll also learn how to use the bind method to capture the special event that occurs when the user selects an item from the treeview. To add new columns to the treeview, configure the columns property. I'll say treeview.config columns and you pass the columns property a list of the names of the columns you want to include. So I'm going to just include one additional column called version. And you can see that got added here, it doesn't have a title yet, but you'll see a small divider in the middle between the two columns. To configure the properties of a column we'll use the column method of the treeview. With a column method the first paramter is the name of the column we want to…

Contents