[Tkinter-discuss] pybwidget newbie questions re: Tree
Arthur C
arthurc at rogers.com
Wed Dec 22 16:33:00 CET 2004
Figured out my problem. There is a bug in the
pybwidget Tree::nodes() member.
The correct code should be:
def nodes(self, node, *args):
return self.tk.call(self._w, "nodes", node, *args)
The "node" argument was not being passed into the call
function. BTW, I did define a constant ROOT
ROOT='root'
and it works as expected. I don't follow your comment
that is different than NORMAL. In Tcl, you'd do:
Tree .tree
.tree insert end root bob -text "Bob"
.tree nodes root
In Python, I'm doing:
ROOT='root'
tree = Tree( ... )
tree.insert( END, ROOT, 'bob', text = 'Bob' )
tree.nodes( ROOT )
Looks like I'll modify the pybwidget package to fit my
needs. I'll submit any changes to the author for
consideration.
A
--- Stewart Midwinter <stewart.midwinter at gmail.com>
wrote:
> Arthur:
>
> you can't extend the idea of NORMAL to ROOT. NORMAL
> is a variable
> with content 'normal', but root is an object. I'm
> guessing that your
> tree node deletion fails because you have root in
> quotes - it's not a
> string. But I haven't worked with that module yet.
>
> The other thing might be to look in pybwidget.py,
> since there are some
> clues in there. And lastly, since bwidget are TCL
> widgets, you may
> want to look into the tcl code. I know, it's kind
> of strange if you
> are used to python...
>
> After you get it all working, please consider
> visiting the wiki at
> http://tkinter.unpy.net/wiki/ and add some text and
> a screen print for
> the bwidget tree widget.
>
> thanks
> S
>
>
> On Tue, 21 Dec 2004 16:57:07 -0500 (EST), Arthur C
> <arthurc at rogers.com> wrote:
> > - I've gotten used to Tkinter's definition of
> > constants such as NORMAL (which is merely a string
> > 'normal') for certain argument values. When
> adding
> > nodes off the root to a Tree, the Tcl code uses
> the
> > name root. I was expecting to do something like:
> >
> > t = Tree( ... )
> > t.insert( END, ROOT, text = 'Something' )
> >
> > Okay, so not ROOT constant exists. So, what do I
> use?
> > I'm guess 'root'. Changed the code to:
> >
> > t.insert( END, 'root', text = 'Something' )
> >
> > Now, I want to delete all the nodes in the tree.
> So I
> > want to do something like:
> >
> > t.delete( t.nodes( 'root' ) )
> >
> > However, doing so gives the following error:
> >
> > TclError: wrong # args: should be "Tree::nodes
> path
> > node ?first? ?last?"
> >
> > Any idea what the issue is? FYI, I'm using
> > pybwidget-0.1.1_1.7.0
> >
> > Thanks for any clues offered.
> >
> > Regards,
> > Arthur
> > _______________________________________________
> > Tkinter-discuss mailing list
> > Tkinter-discuss at python.org
> >
>
http://mail.python.org/mailman/listinfo/tkinter-discuss
> >
>
>
> --
> Stewart Midwinter
> stewart at midwinter.ca
> stewart.midwinter at gmail.com
>
More information about the Tkinter-discuss
mailing list