# Using the tree (drill-down) widget

Note: this has not been edited yet from the original form

The tree widget from the BWidget package is useful for displaying hierarchical information. Because it can be drilled-down or drilled-up it can be a way to save space in a user-interface while still providing the user with all of the information that they need.

In the example below, we create a simple tree with four records (nodes), each containing two child nodes (“Name” and “Age”), each of which contains one child node, (the corresponding value for its parent node).

The tree can be drilled down.

### Determining the currently selected node

An item in the tree can be selected by clicking with the mouse. To find out which node is currently selected, use:

### Deleting A Node

To delete a node (and all of its children), use:

Now the age has been deleted from the first record.

### Images

The tree widget can also be used to display images, by using the image option in tkinsert() instead of the text option (not shown).