Please help me with the idea to select all row at once using ctrl+a key in treeview widget tkinter python.Thank you.
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
cols = ('name','age')
e = ttk.Treeview(root,columns=cols)
for col in cols:
e.heading(col, text=col)
e.column(col,minwidth=0,width=170)
e.pack()
e.insert("","end",values=("ss",66))
e.insert("","end",values=("yy",11))
root.mainloop()
You have to bind a callback function to the according keyboard event. The function itself needs access to the Treeview widget. You can do this by binding e
in a closure:
root.bind('<Control-a>', lambda *args: e.selection_add(e.get_children()))