Skip to content
Snippets Groups Projects
listview.py 708 B
Newer Older
Benoit Favre's avatar
Benoit Favre committed
from gi.repository import GObject, Gtk, Pango

class ListView(Gtk.VBox):
    def __init__(self):
        super(ListView, self).__init__()
        store = Gtk.ListStore(GObject.TYPE_PYOBJECT)
        store.append([Section('Section 1')])
        store.append([Section('Section 2')])
        store.append([Section('Section 3')])
        tree = Gtk.TreeView(store)
        renderer = CellRendererButton()
        column = Gtk.TreeViewColumn("Title", renderer, text=0)
        tree.append_column(column)
        self.pack_start(tree, True, True, 0)

if __name__ == '__main__':
    window = Gtk.Window()
    window.connect("destroy", Gtk.main_quit)
    window.add(ListView())
    window.show_all()
    Gtk.main()