3
# $Id: tk04.in 11657 2011-03-19 21:57:18Z airwin $
7
# @> A script illustrating use of 2-d tcl api (plframe).
8
###############################################################################
15
###############################################################################
16
# Set up the menubar and message widgets.
18
frame .menu -relief raised -borderwidth 3
20
button .menu.comp -text "Compute Function" -command "compute"
21
button .menu.contour -text "Line Contour" -command "contour"
22
button .menu.shade -text "Color Fill Contour" -command "shade"
23
pack .menu.comp .menu.contour .menu.shade -side left
25
button .menu.exit -text "Exit" -command "destroy ."
26
pack .menu.exit -side right
29
-font -Adobe-helvetica-medium-r-normal--*-240* -aspect 200 \
30
-width 500 -borderwidth 1 \
31
-text "TK04: 2-d Tcl API"
33
pack .menu .msg -fill x
35
tk_menuBar .menu .menu.comp .menu.contour .menu.shade .menu.exit
38
pack .plw -side bottom -expand 1 -fill both
42
# This is the front end to the data computation. Initially we just
43
# create the matrix to hold the data, and then vector down to the C
44
# side to set the data. However, one could easily embellish this to
45
# accept specifications from the user (via Tk entries), and act on
46
# them. For instance, choosing the size of the matrix, passing
47
# paramaters to the compiled side, etc.
56
# Draw a contour of the data.
63
.plw plvpor 0.1 0.9 0.1 0.9
64
.plw plwind 1. 64. 1. 64.
67
.plw pllab "(x)" "(y)" "#frPLplot Example Tk04"
69
# plot the data points
78
for {set i 0} {$i < 10} {incr i} {
79
clev $i = [expr $min + ($max-$min)*($i+.5)/10 ]
85
.plw plbox "bcnst" 0.0 0 "bcnstv" 0.0 0
93
.plw plvpor 0.1 0.9 0.1 0.9
94
.plw plwind 0. 1. 0. 1.
97
.plw pllab "(x)" "(y)" "Cool shade plot example from Tcl"
107
for {set i 0} {$i < 20} {incr i} {
108
set sh_min [expr $min + ($max-$min)*$i/20.]
109
set sh_max [expr $min + ($max-$min)*($i+1)/20.]
110
set sh_col [expr $i/20.]
112
.plw plshade x $xmin $xmax $ymin $ymax $sh_min $sh_max 1 $sh_col 0 \
119
.plw plbox "bcnst" 0.0 0 "bcnstv" 0.0 0
122
###############################################################################