forked from SVIG/python-bootcamp
update
This commit is contained in:
@@ -2,6 +2,7 @@ import sys
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
|
||||
def on_treeview_heading_click(column, tree):
|
||||
data = [(tree.set(child, column), child) for child in tree.get_children("")]
|
||||
reverse = (column == tree.heading(column)["text"]) and not column.startswith("_")
|
||||
@@ -38,6 +39,10 @@ tree.column('#0', width=20, stretch=False)
|
||||
|
||||
tree.tag_configure("selected", background="#ccc")
|
||||
|
||||
# Call the on_treeview_heading_click function when a column heading is clicked
|
||||
for col in tree["columns"]:
|
||||
tree.heading(col, text=col, anchor=tk.W, command=lambda col=col: on_treeview_heading_click(col, tree))
|
||||
root.mainloop()
|
||||
# Call the on_treeview_heading_click function when a column heading is clicked
|
||||
for col in tree["columns"]:
|
||||
tree.heading(col, text=col, anchor=tk.W, command=lambda col=col: on_treeview_heading_click(col, tree))
|
||||
|
||||
Reference in New Issue
Block a user