#!/usr/bin/wish canvas .c pack .c proc d_rect {args} { # First, specify some defaults. set arr(-thickness) 1 set arr(-color) blue # Then, 'parse' the user-supplied options and values. array set arr $args # Create the rectangle. .c create rectangle $arr(-x1) $arr(-y1) $arr(-x2) $arr(-y2) \ -width $arr(-thickness) -outline $arr(-color) } proc d_text {args} { # First, specify some defaults. set arr(-anchor) c set arr(-color) blue # Then, 'parse' the user-supplied options and values. array set arr $args # Create the text. .c create text $arr(-x) $arr(-y) -text "$arr(-text)" \ -anchor $arr(-anchor) -fill $arr(-color) } source "datafile.dat"