[pygtk] Multilevel ListStore
walter at translate.org.za
Tue Jul 8 15:04:03 WST 2008
Run pygtk-demo. The only real difference to a normal ListStore is =
specifying the parent gtk.TreeIter when you add rows:
model =3D gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
parentIter =3D model.append(None)
0, "Parent (1st col)",
1, "Parent (2nd col)"
childIter =3D model.append(parentIter)
0, "Child (1st col)",
1, "Child (2nd col)"
childIter2 =3D model.append(parentIter)
0, "Child2 (1st col)",
1, "Child2 (2nd col)"
This will add a top-level row (referenced by parentIter) and two rows =
under it (referenced by childIter and childIter2). Then you can do =
"level2iter =3D model.append(childIter)" to add a row with the first child =
row (childIter) as its parent.
The PyGtk tutorial also covers this in section 126.96.36.199 ("Adding Rows to =
a TreeStore") and that's about as hard as it gets.
Hope this helps.
P.S. The code above was written on-the-go, so it might not be 100% correct.
Shadi Azoum wrote:
> Thanks for the tip, Paul. Any code example on using TreeStore? The offici=
al pygtk tutorials offer little support.
> ----- Original Message -----
> From: Paul Pogonyshev <pogonyshev at gmx.net>
> Date: Sunday, July 6, 2008 3:51 am
> Subject: Re: [pygtk] Multilevel ListStore
> To: pygtk at daa.com.au
> Cc: Shadi Azoum <ssa03d at fsu.edu>
>> Shadi Azoum wrote:
>>> Any help would be greatly appreciated.
>> Use gtk.TreeStore instead.
> pygtk mailing list pygtk at daa.com.au
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 263 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080708/fe20dd51/w=
More information about the pygtk