我正在尝试按列对Treeview小部件进行排序。具体来说,我想通过巡逻对树视图进行排序。
# Add Sorting
l = [(AttendanceView.set(k, AttendanceView['columns'][2]), k) for k in AttendanceView.get_children('')]
print("In sort")
# rearrange items in sorted positions
for index, (val, k) in enumerate(l):
AttendanceView.move(k, '', index)
热线:
print(AttendanceView['columns'])
产量:
('firstname', 'secondname', 'patrol', 'present')