next up previous contents index
Next: Interface to picking Up: Tutorials and Examples Previous: Drawing a box around

Adding a label

 

Here's a quick way to add your own label to an atom selection. This function take the selection text and the labels that atom (in the top molecule) with the given string. It returns with an error if more anything other than one atom is selected.

proc label_atom {selection_string label_string} {
    set sel [atomselect top $selection_string]
    if {[$sel num] != 1} {
        error "label_atom: '$selection_string' must select 1 atom"
    }
    # get the coordinates of the atom
    lassign [$sel get {x y z}] coord
    # and draw the text
    draw text $coord $label_string
}



Justin Gullingsrud
Tue Apr 6 09:22:39 CDT 1999