|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Multilevel ListStoreHi,
I am trying to make a hierarchal structure using the PyGTK ListStore. What would the code look like for a multilevel structure such as the one below: Parent 1 Child 1.1 Child 1.2 Parent 1.3 Child 1.3.1 Child 1.3.2 Child 1.4 Parent 2 Child 1 Child 2 ... I know the code if it was just one parent with multiple children, but not when those children are the parents of others. Any help would be greatly appreciated. -Shadi Azoum _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
|
Re: Multilevel ListStoreShadi Azoum wrote:
> Any help would be greatly appreciated. Use gtk.TreeStore instead. Paul _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
|
Re: Multilevel ListStoreThanks for the tip, Paul. Any code example on using TreeStore? The official pygtk tutorials offer little support.
----- Original Message ----- From: Paul Pogonyshev <pogonyshev@...> Date: Sunday, July 6, 2008 3:51 am Subject: Re: [pygtk] Multilevel ListStore To: pygtk@... Cc: Shadi Azoum <ssa03d@...> > Shadi Azoum wrote: > > Any help would be greatly appreciated. > > Use gtk.TreeStore instead. > > Paul > _______________________________________________ pygtk mailing list pygtk@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
|
Re: Multilevel ListStoreHi,
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 <pogonyshev@...> > Date: Sunday, July 6, 2008 3:51 am > Subject: Re: [pygtk] Multilevel ListStore > To: pygtk@... > Cc: Shadi Azoum <ssa03d@...> > > >> Shadi Azoum wrote: >> >>> Any help would be greatly appreciated. >>> >> Use gtk.TreeStore instead. >> >> Paul >> >> > _______________________________________________ > pygtk mailing list pygtk@... > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ > [walter.vcf] begin:vcard fn:Walter Leibbrandt n:Leibbrandt;Walter org:Translate.org.za adr:;;;Pretoria;Gauteng;;South Africa email;internet:walter@... 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@... http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
| Free Forum Powered by Nabble | Forum Help |