Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tree widget

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Dear Sir's

Can I create a tree widget as you see in windows file explorer using Tk

For ex; To start with the C drive is collapsed with + sign indicating it's collapsed state.
When clicked on the + sign one can see all the folders and files and under C drive.
Please refer the following sketch.

Mail me at dinesh@altair-eng.soft.net


_______
| |
| + |--- C: |______|



_______
| |
| - |--- C:\-----
|______| |
|---------Program files
|
|
|---------My file
|
|
|--------Picture files
 
The short answer is "yes". I would look at the "tree.tcl" script that is part of the BWidgets package (it is installed along with version 8.3.4.2). Unless you want to do it as a project, why not just use that? Bob Rashkin
rrashkin@csc.com
 
The answer is: "Yes. Which extension do you want to use?" The widget is often called a "tree" or a "hierarchy" or a "hierarchy box," and is implemented in several packages. So, you can experiment with several of them and see which one you like the most.

BWidgets, mentioned above by Bong, is a nice alternative because it is a Tcl/Tk-only extension (no C code), which makes it a snap to use on any platform. It includes the Tree megawidget that he mentioned. (Megawidget is Tcl terminology for something that appears like a single widget programmatically, but is actually composed of several more basic widgets.) You can find out more information about BWidgets at and
The Tix extension has a widget called tixTree, which is actually a megawidget composed of several other Tix building blocks. The core of Tix is written in C, so it might provide better performance for really big hierarchies. You can find more information about Tix at and
The widely-used BLT extension has the hierbox widget. BLT is a good, solid package that's been around for years. You can find more information about BLT at and
There are probably others (I think [ignore][incr Widgets[ignore]] has a hierarchy box), but that should be enough to get you started. In general, to start looking for things like this, I highly recommend the Tcler's Wiki, a collaboratively-edited repository of Tcl wisdom, which can be reached at the Persistent URL of You can also check out the Tcl Developer's Xchange, a Yahoo!-style catalog of Tcl resources, at but that site is starting to suffer a bit of link rot. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top