You can add as many columns to the tree view as you need, without restricting the columns of the model. If the required data is not available in the model, you can set a callback for the column:
import gtk def inIta(col, cell, model, iter, mymodel): s = model.get_string_from_iter(iter) niter = mymodel.get_iter_from_string(s) obj = mymodel.get_value(niter, 0) cell.set_property('text', obj) model = gtk.ListStore(str) model2 = gtk.ListStore(str) view = gtk.TreeView(model) rend1 = gtk.CellRendererText() col1 = gtk.TreeViewColumn('hello', rend1, text=0) view.append_column(col1) rend2 = gtk.CellRendererText() col2 = gtk.TreeViewColumn('ciao', rend2) col2.set_cell_data_func(rend2, inIta, model2) view.append_column(col2) model.append(['hello world']) model2.append(['ciao mondo']) win = gtk.Window() win.connect('delete_event', gtk.main_quit) win.add(view) win.show_all() gtk.main()
source share