[pygtk] back to my tree view

shawn bright nephish at gmail.com
Wed Oct 25 12:06:19 WST 2006


Hey that worked !
thanks for your help with this, seems easy now, he he.

again, thanks
sk

On 10/24/06, Thomas Mills Hinkle <tmhinkle at gmail.com> wrote:
>
> On 10/24/06, shawn bright <nephish at gmail.com> wrote:
> >
> > ok, i have my tree view and populated with a list like the tutorial
> > said, however, i need a way to refresh the list.
> > here is what i have so far
> >
> > self.group_treeiter =3D self.group_model.get_iter_first()
> > self.group_model.clear ()
> > for name in name_list:
> >             self.treeiter =3D self.group_model.append(None,name)
> >
> > self.group_tree_view.set_model(self.group_model)
> > self.group_column =3D gtk.TreeViewColumn('Groups')
> > self.group_tree_view.append_column (self.group_column)
> > self.view =3D gtk.CellRendererText()
> > self.group_column.pack_start(self.view, True)
> > self.group_column.add_attribute(self.view, 'text', 0)
> >
> > it works so far, but when i run it again, instead of clearing out the
> > list view, it starts a new column.
> > this just cannot be. Anyone see off hand what i am doing wrong here?
>
>
> All of the code relating to the treeview (as opposed to the tree model)
> should only be called once.
>
> The idea here is that display (the treeview) and the underlying data model
> (treemodel) are separate. You set up a treeview with columns, etc., only
> once -- changes in the treemodel will then automatically be reflected in =
the
> display.
>
> So the only call above that you need to repeat are:
>
> self.group_model.clear ()
> self.group_treeiter =3D self.group_model.get_iter_first()
> for name in name_list:
>             self.treeiter =3D self.group_model.append(None,name)
>
> Tom
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061024/a29b8eb9/at=
tachment.htm


More information about the pygtk mailing list