From the course: Python GUI Development with Tkinter
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Building a hierarchical treeview
From the course: Python GUI Development with Tkinter
Building a hierarchical treeview
- [Instructor] The treeview widget can be used to display a list of items that the user can interact with and make selections from. Those items can be presented on a single level or as part of a multi-tiered hierarchy. To begin, I've already imported my tkinter package, as well as the themed Tk module. And I've created a root window using the Tk constructor method. To create my treeview and store it in a variable called treeview, I'm going to use the ttk Treeview constructor method and I'll pass it the root as the parent. I'll add the treeview to my root window using the pack command. You'll see that the treeview is created here, but it's currently empty. To use it, you need to add one or more items to the tree. Each item represents a node in the tree and can be referenced by a unique item name or id. Those item names and ids can be chosen by the programmer at the time when the item is created or tkinter will automatically generate a unique id itself. To insert an item into the tree…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Entering and displaying multiple lines with the Text widget11m 31s
-
(Locked)
Adding tags, marks, images, and widgets to the Text widget9m 57s
-
(Locked)
Building a hierarchical treeview7m 19s
-
(Locked)
Adding columns and selecting items in the Treeview7m 12s
-
(Locked)
Building cascading menus11m 5s
-
(Locked)
Drawing a basic line on the Canvas5m 21s
-
(Locked)
Drawing complex shapes on the Canvas9m 58s
-
(Locked)
Attaching a scroll bar to widgets6m 21s
-
(Locked)
Configuring widget styles9m 49s
-
(Locked)
Prompting users with the Messagebox and dialogs6m 11s
-
(Locked)
-
-
-
-