I have had very similar experiences with liststore.clear() in
Python3.5 and Mint 18. To work around this I do:

store = treeview.get_model()  #may not be necessary in your code
treeview.set_model(None)
store.clear()
store.append('my string or etc')
treeview.set_model(store)
This works. Disconnecting the "model" from the "view" before doing
clear is the key. But very uncomfortable.

What not worked was to unselect before doing clear. I don't understand
why.

This all sounds to me like a mystic behaviour what could be a bug. But
I am not deep enough into Gtk so I won't open an official report about
this. It is on the core devs and experts in that list to decide if this
is an serious issue or not.

I agree with you. However, since I found this code on a Gtk website, specifically for common problems with using Gtk, I assume it is the recommended way. I don't remember where I found it or I would post a link.

And after you study the MVC pattern, you will see why the whole Treeview stack works the way it does. Google MVC and Gtk MVC. It is worthwhile reading if you plan on constructing treeviews. It may not make sense immediately, but eventually you may see the light like I did.

Reuben

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to