I'm writing an app using Gtk/PyGI, and I need to create a sidebar with a Nautilus-like tree.
However, Gtk refuses to cooperate with me. I tried both with Glade and GtkBuilder (creating the GtkTreeStore with one
gchararray column) and with this code:
self.hbox = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL)
self.treestore = Gtk.TreeStore(str)
self.treeview = Gtk.TreeView(self.treestore)
self.hbox.pack_start(self.treeview, True, True, 0)
Both versions raise a
TypeError: Expected Gtk.TreeIter, but got StructMeta starting at the first
self.treestore.append() in my code and trickling down through the library's files.
I thought it's because GtkTreeStore's
.append also takes a GtkTreeIter, but if I pass something like "0" as the first argument nothing changes, if I pass something like
self.treestore.get_iter("0") it errors out saying it's an invalid tree path, and if I pass
None it works, but shows an empty window.
I tried replacing the GtkTreeStore with a GtkListStore. The result doesn't error out - instead, it shows the very same empty window as before.
So, what am I doing wrong? I went through the docs time and time again, but I still can't figure it out.