473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tix Tree open/close issue

Hi,

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

The following code:
<code>
from Tix import *

r=Tk()

tr=Tree(r)
tr.subwidget('h list').add('br1 ',text='branch 1')
tr.subwidget('h list').add('br1 .b1',text='bran ch 1-1')
tr.subwidget('h list').add('br1 .b1.b1',text='b ranch
1-1-1')
tr.subwidget('h list').add('br1 .b1.b2',text='b ranch
1-1-2')
tr.subwidget('h list').add('br1 .b2',text='bran ch 1-2')
tr.subwidget('h list').add('br1 .b2.b1',text='b ranch
1-2-1')
tr.subwidget('h list').add('br1 .b2.b2',text='b ranch
1-2-2')
r.tk.call(tr,'s etmode','br1',' close')
r.tk.call(tr,'s etmode','br1.b1 ','open')
r.tk.call(tr,'s etmode','br1.b2 ','open')
#tr.setmode('br 1','close')
#tr.setmode('br 1.b1','open')
#tr.setmode('br 1.b2','open')
tr.grid()

r.mainloop()
</code>

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
Jul 13 '06 #1
1 2549
Sorin Schwimmer wrote in news:mailman.81 42.1152816058.2 7775.python-
li**@python.org in comp.lang.pytho n:
The following code:
<code>
from Tix import *

r=Tk()

tr=Tree(r)
tr.subwidget('h list').add('br1 ',text='branch 1')
tr.subwidget('h list').add('br1 .b1',text='bran ch 1-1')
tr.subwidget('h list').add('br1 .b1.b1',text='b ranch
1-1-1')
tr.subwidget('h list').add('br1 .b1.b2',text='b ranch
1-1-2')
tr.subwidget('h list').add('br1 .b2',text='bran ch 1-2')
tr.subwidget('h list').add('br1 .b2.b1',text='b ranch
1-2-1')
tr.subwidget('h list').add('br1 .b2.b2',text='b ranch
1-2-2')
r.tk.call(tr,'s etmode','br1',' close')
r.tk.call(tr,'s etmode','br1.b1 ','open')
r.tk.call(tr,'s etmode','br1.b2 ','open')
#tr.setmode('br 1','close')
#tr.setmode('br 1.b1','open')
#tr.setmode('br 1.b2','open')
Try instead:

tr.setmode('br1 .b1','close')
tr.setmode('br1 .b2','close')
tr.setmode('br1 ','close')
tr.close('br1.b 2')
tr.close('br1.b 1')
tr.grid()

r.mainloop()
</code>

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...ree-class.html

<quote>
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.
</quote>

Rob.
--
http://www.victim-prime.dsl.pipex.com/
Jul 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4989
by: serge calderara | last post by:
Dear all, I have the configuration part of my application which will handle different element configuartion based on tree view object similar as MMC and snap in. Configuration data are retrive and save in a local database for each component. What is the best way to populate my tree view control.
4
4806
by: plork | last post by:
I'm trying to code a tree structure using javascript, the nodes of the tree are generated from a sql table. Has anyone some code for this? Cheers
6
2726
by: Dennis Allen | last post by:
Hi. I was wondering if someone here could help me. My web site has a very simple folder tree menu bar. Example: <a id="club_t" href="##" onclick="return Outline(this)"><img id="club_i" alt="" border="0" src="fold.gif">Club&nbsp;Links</a><br> <div id="club_s" class="off"> <a href="articles.htm" target="main">Articles/Cartoons</a><br> <a href="photo1.htm" target="main">Astro&nbsp;Images</a><br> <a href="links.htm"...
0
1469
by: Burt | last post by:
I have an ASP.NET page that performs a window.open to an HttpHandler that streams a binary file to the brower. I am forcing the save_as... dialog in IE. My issue is that in IE6 the new window opens and the download starts. When the download is cancelled or completed the window automatically closes, which is exactly what I want to happen. The issue is that in IE7 Beta 2 the window just stays open. I've tried using a simple aspx page...
9
7820
by: raylopez99 | last post by:
What's the best way of implementing a multi-node tree in C++? What I'm trying to do is traverse a tree of possible chess moves given an intial position (at the root of the tree). Since every chess position has around 30 moves, it would mean every node of the tree would have 30 branches (on average), which in turn themselves would average about 30 branches each. I can think of a variety of ways of implementing this, including a series...
0
1723
by: teju | last post by:
Hi all, I am trying to populate tree view from the database. Till two levels i can populate it fine but when it reaches third level it doesn't expand. Below is the code, it has been taken from the reference of micrososft Sub PopulateNode(ByVal sender As Object, ByVal e As TreeNodeEventArgs) ' Call the appropriate method to populate a node at a particular level. If e.Node.ChildNodes.Count = 0 Then Select Case...
2
2240
by: Bart Kastermans | last post by:
Summary: can't verify big O claim, how to properly time this? On Jun 15, 2:34 pm, "Terry Reedy" <tjre...@udel.eduwrote: Thanks for the idea. I would expect the separation to lead to somewhat more code, but all the "checking the root" code would be separated out in the tree class. The node class would be very smooth. I'll try this when I have
3
2452
by: FARAECHILIBRU | last post by:
i'm building a binary tree the problem is when i'm reading from e text file .First i'm sending to tree builder function a empty node and e new node the function return me firt node of a tree, but when i try to built the secund node ,i dont anderstend whay, my program write to my new node and to first tree node; string readLine(istream& fin) { char buff; // Clear any remaining end of line characters if(fin.peek()=='\n') {...
1
1958
by: CAM | last post by:
Hello, I am using Visual Basic.Net 2008 and in my main menu form I have a tree view in one of the child node I have a code that opens another form. Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect If e.Node.Name = "NodeUnassigned" Then
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.