Python Forum

Full Version: How to insert 'Checkbutton' to 'Treeview' and associate each item?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to insert 'Checkbutton' to 'Treeview' and associate each item to know which items selected,
like this:

[Image: 36356.jpg]

how to do that?
Thanks.
Huh
install ttkwidgets: pip install ttkwidgets

Then use example (comes with source): https://github.com/TkinterEP/ttkwidgets

# -*- coding: utf-8 -*-

# Copyright (c) Juliette Monsel 2017
# For license see LICENSE

from ttkwidgets import CheckboxTreeview
import tkinter as tk

root = tk.Tk()

tree = CheckboxTreeview(root)
tree.pack()

tree.insert("", "end", "1", text="1")
tree.insert("1", "end", "11", text="11")
tree.insert("1", "end", "12",  text="12")
tree.insert("11", "end", "111", text="111")
tree.insert("", "end", "2", text="2")

root.mainloop()
Helpful.
Smile