On Tue, 30 May 2000, Joshua D. Boyd wrote:

> On Sat, 27 May 2000, James Henstridge wrote:
> > For the GtkCTree, you don't use GtkTree of GtkTreeItem widgets.  Instead,
> > you create the items in the tree with the insert_node method.
> > 
> >   tree = gtk.GtkCTree(1, 0)
> >   node1 = tree.insert_node(None, None, ['an item'])
> >   node2 = tree.insert_node(None, None, ['another item'])
> >   node3 = tree.insert_node(node2, None, ['a subitem'])
> >   node4 = tree.insert_node(node2, node3, ['another subitem'])
> 
> OK, I tried that, and I get a tree with two visible nodes, and no way to
> expand the second node.  So, I was poking around the GTK+ documentation,
> and that turned up nothing, so I poked through the gtk.py file, and found
> that node2 when created above defaults to being a leaf, and apperently you
> have to manually tell it that it isn't a leaf.  Here is the way the node2
> = line should read (this is probably clunkier than it needs to be, but I'm
> very new to python):
> 
> node2 = MyTree.insert_node(None, None, ['another item'], 5, None, None,
> None, None, FALSE)
> 
> The 5, followed by the 4 Nones are the default parameters for various
> optional parameters (due to being very new to python, I wasn't sure how to
> set the last parameter in the parameter list without having to set the
> prior ones.  The FALSE says that this node isn't a leaf (leaf nodes
> obviously should say TRUE there).  
> 
> Maybe everyone in the world but me knew this, but I thought I'd post it
> anyway just in case.   Anyway, back to coding.

Oops.  Sorry about that.  You could also use the following:
  MyTree.insert_node(None, None, ['another item'], is_leaf=FALSE)

> 
> --
> Joshua Boyd
> http://catpro.dragonfire.net/joshua

James.

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


-
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to