Le 27/07/2018 à 23:05, c.buhtz--- via gtk-app-devel-list a écrit : > Dear Reuben > > On 2018-07-23 08:03 Reuben Rissler <sil...@emypeople.net> wrote: >> This is how I have done it in the past. Note, I do not proclaim >> spectacular or Pythonic code, and would humbly accept any corrections >> and/or better ways to accomplish this. It seems to me there should be >> a way to let the TreeView do this work itself, but alas, I have not >> found it yet. > > Your code works for me - thank you very much. But I also have the > question if anyone here could improve it or show a more easier and > elegant way.
If it's only for reordering the elements in the tree view, you can use the built-in Gtk.TreeView.set_reorderable() method [1], and you're all set. You get inserted/deleted signals for moved rows so you can know when and how things changed if needed, and the underlying model is also changing accordingly. Regards, Colomban [1] https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-reorderable _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list