def create_treelist(self):
"""create_treelist
Create list of options
"""
# Add some messages to the window
self.liststore = gtk.ListStore(str,str,'gboolean')
# we'll add some data now
self.liststore.append(['Kernel', gtk.STOCK_OPEN, True])
self.liststore.append(['CPU', gtk.STOCK_OPEN, True])
self.liststore.append(['RAM', gtk.STOCK_OPEN, True])
self.liststore.append(['Sound Modules', gtk.STOCK_OPEN, True])
self.liststore.append(['Sound Devices', gtk.STOCK_OPEN, True])
self.liststore.append(['Asound', gtk.STOCK_OPEN, True])
# create the TreeViewColumn to display the data
self.tvcolumn = gtk.TreeViewColumn('Categories')
# Append liststore model to treeview
self.treeview1.set_model(model=self.liststore)
# add tvcolumn to treeview
self.treeview1.append_column(self.tvcolumn)
# create a CellRendererText to render the data
self.cell = gtk.CellRendererText()
self.cell0 = gtk.CellRendererPixbuf()
# add the cell to the tvcolumn and allow it to expand
self.tvcolumn.pack_start(self.cell0, True)
self.tvcolumn.pack_start(self.cell, True)
# set the cell "text" attribute to column 0 - retrieve text
# from that column in treestore
self.tvcolumn.set_cell_data_func(self.cell0, self.make_pixbuf)
self.tvcolumn.add_attribute(self.cell, 'text', 0)
return
评论列表
文章目录