pythontkinter

tkinter treeview - drag and drop?


I can see how to cut and paste nodes in a tree or move them up and down using buttons or key bindings. Is there a way to implement dragging and dropping nodes around the treeview?


Solution

  • You will have to set this up yourself, but it's definitely possible. You'll simply need to make appropriate bindings for <ButtonPress-1> (identify the item to be dragged), <ButtonRelease-1> (implement the drop), and <B1-Motion> (provide feedback during the drag)