I’m having a hard time trying to wrap my head around the new Gtk4 ListView model / paradigm. It seems to be completely different, at least syntactically, from the Gtk.TreeView(ListStore).append_column(column) system which was already not trivial - and quite different from the Gtk2 model, but so much time has passed I can’t really remember. The concept of “item factory” in particular is really puzzling me, but I’ll surely understand once I see one practical example, I found one example but it’s quite cryptic, looks overly convoluted, and uses unusual imports, custom classes and methods that I did not manage to understand, let alone apply to my project. I making a single column list that complicated?
<object class="GtkScrolledWindow" id="playListWindow"> <child> <object class="GtkTreeView" id="treeview"> <property name="model">listStore</property> <child> <object class="GtkTreeViewColumn" id="test-column"> <property name="title">Test</property> <child> <object class="GtkCellRendererText" id="test-renderer"/> </child> </object> </child> <child internal-child="selection"> <object class="GtkTreeSelection" id="selection"> <signal name="changed" handler="on_treeview_selection_changed"/> </object> </child> </object> <!-- (...) --> <object class="GtkListStore" id="listStore"/> <object class="GtkTreeModelSort" id="treeModel"> <property name="model">listModel</property> </object>
And, naively, in I tried to append() things to the listStore, the closest I got was “row has the wrong number of items” but that’s it. It really feels close, though… could it be that simple?
Sometimes I’m able to port / translate the C examples to Python, but in this case I really don’t know, is it me or is is really complex?
It’s been two days now, I just need a list… Can a kind spirit guide me towards a simple, 2 colums - 2 rows Python example?