Tix Tree open/close issue

2006-07-14 Thread Sorin Schwimmer
It works. Thanks Rob.

Sorin

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tix Tree open/close issue

2006-07-13 Thread Rob Williscroft
Sorin Schwimmer wrote in news:mailman.8142.1152816058.27775.python-
[EMAIL PROTECTED] in comp.lang.python:

> The following code:
> 
> from Tix import *
> 
> r=Tk()
> 
> tr=Tree(r)
> tr.subwidget('hlist').add('br1',text='branch 1')
> tr.subwidget('hlist').add('br1.b1',text='branch 1-1')
> tr.subwidget('hlist').add('br1.b1.b1',text='branch
> 1-1-1')
> tr.subwidget('hlist').add('br1.b1.b2',text='branch
> 1-1-2')
> tr.subwidget('hlist').add('br1.b2',text='branch 1-2')
> tr.subwidget('hlist').add('br1.b2.b1',text='branch
> 1-2-1')
> tr.subwidget('hlist').add('br1.b2.b2',text='branch
> 1-2-2')
> r.tk.call(tr,'setmode','br1','close')
> r.tk.call(tr,'setmode','br1.b1','open')
> r.tk.call(tr,'setmode','br1.b2','open')
> #tr.setmode('br1','close')
> #tr.setmode('br1.b1','open')
> #tr.setmode('br1.b2','open')

Try instead:

tr.setmode('br1.b1','close')
tr.setmode('br1.b2','close')
tr.setmode('br1','close')
tr.close('br1.b2')
tr.close('br1.b1')

> tr.grid()
> 
> r.mainloop()
> 
> 
> will show the whole tree, but will set correctly the
> (+) and (-) boxes. (The commented out statements where
> in place before direct calls to Tk - same result).
> 
> I was hoping to have some branches hidden (the leaves,
> in this case).

My solution above make any sense till I read the docs, 

http://epydoc.sourceforge.net/stdlib/public/Tix.Tree-class.html


say:

setmode(self, entrypath, mode='none') 

[snip]
...   If mode is set to close, a (-)
indicator is drawn next the the entry. 
...   The
open mode indicates the entry has hidden children and this entry can be
opened by the user. The close mode indicates that all the children of the
entry are now visible and the entry can be closed by the user.


Rob.
-- 
http://www.victim-prime.dsl.pipex.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Tix Tree open/close issue

2006-07-13 Thread Sorin Schwimmer
Hi,

I tried for the first time a Tix Tree, so, if my
question is naive, I apologize upfront.

The following code:

from Tix import *

r=Tk()

tr=Tree(r)
tr.subwidget('hlist').add('br1',text='branch 1')
tr.subwidget('hlist').add('br1.b1',text='branch 1-1')
tr.subwidget('hlist').add('br1.b1.b1',text='branch
1-1-1')
tr.subwidget('hlist').add('br1.b1.b2',text='branch
1-1-2')
tr.subwidget('hlist').add('br1.b2',text='branch 1-2')
tr.subwidget('hlist').add('br1.b2.b1',text='branch
1-2-1')
tr.subwidget('hlist').add('br1.b2.b2',text='branch
1-2-2')
r.tk.call(tr,'setmode','br1','close')
r.tk.call(tr,'setmode','br1.b1','open')
r.tk.call(tr,'setmode','br1.b2','open')
#tr.setmode('br1','close')
#tr.setmode('br1.b1','open')
#tr.setmode('br1.b2','open')
tr.grid()

r.mainloop()


will show the whole tree, but will set correctly the
(+) and (-) boxes. (The commented out statements where
in place before direct calls to Tk - same result).

I was hoping to have some branches hidden (the leaves,
in this case).

How should I proceed?

Thanks,
Sorin

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list