Hi,
Run pygtk-demo. The only real difference to a normal ListStore is
specifying the parent gtk.TreeIter when you add rows:
<code>
model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
parentIter = model.append(None)
model.set(parentIter,
0, "Parent (1st col)",
1, "Parent (2nd col)"
)
childIter = model.append(parentIter)
model.set(childIter,
0, "Child (1st col)",
1, "Child (2nd col)"
)
childIter2 = model.append(parentIter)
model.set(childIter2,
0, "Child2 (1st col)",
1, "Child2 (2nd col)"
)
</code>
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 = model.append(childIter)" to add a row with the first child
row (childIter) as its parent.
The PyGtk tutorial also covers this in section 14.2.4.2 ("Adding Rows to
a TreeStore") and that's about as hard as it gets.
Hope this helps.
Regards,
Walter
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 official
pygtk tutorials offer little support.
----- Original Message -----
From: Paul Pogonyshev <[EMAIL PROTECTED]>
Date: Sunday, July 6, 2008 3:51 am
Subject: Re: [pygtk] Multilevel ListStore
To: pygtk@daa.com.au
Cc: Shadi Azoum <[EMAIL PROTECTED]>
Shadi Azoum wrote:
Any help would be greatly appreciated.
Use gtk.TreeStore instead.
Paul
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
begin:vcard
fn:Walter Leibbrandt
n:Leibbrandt;Walter
org:Translate.org.za
adr:;;;Pretoria;Gauteng;;South Africa
email;internet:[EMAIL PROTECTED]
title:Developer
tel;work:(012) 460 1095
x-mozilla-html:FALSE
url:http://translate.org.za
version:2.1
end:vcard
_______________________________________________
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/