Jay Graves wrote:

I am trying to have a TreeList with check boxes in the TreeViewColumn
If you don't know what I mean look at the gconf-editor and click around,
you will see one.

Right now I have:
self.keyListModel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, 
gobject.TYPE_BOOLEAN)
.....
self.keyListModel.set_value(iter,0,eachKey)
self.keyListModel.set_value(iter,1,self.keys.get(eachKey))
self.keyListModel.set_value(iter,2,False)
.....
self.col = gtk.TreeViewColumn("key id",gtk.CellRendererText(),text=0)
self.col1 = gtk.TreeViewColumn("name",gtk.CellRendererText(),text=1)
self.col2 = gtk.TreeViewColumn("allow",gtk.CellRendererText())

I have tried putting text=2 in the col2 gtkTreeViewColumn but that just
displays 'False' in the TreeView

Am I on the right track or way off base? Does anyone know how to achieve this?


You want to use a gtk.CellRendererToggle() instead of a CellRendererText(). You want to map active=2 to make the toggle display the state of the 3rd column. If you want the toggle to update the state of the tree, you will need to connect to the cell renderer's "toggled" signal. Your callback might look something like this:
def cell_toggled(cell, path_string, model):
path = tuple([int(i) for i in path_string.split(':')])
row = model[path]
row[2] = not row[2]
model.row_changed(path, row.iter)


(I haven't tested the above, but it is approximately what it should look like).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to