diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-05 07:23:17 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-06-05 07:23:17 (GMT) |
commit | bdc95807199b5fb2ad244fbd2a595825cdee1fc1 (patch) | |
tree | e18f2274df06f9ee7e6d70c2d58b244fba0192c1 /library/demos | |
parent | 884c9570fffd13b20d87151fe979e3e09edd5ed8 (diff) | |
download | tk-bdc95807199b5fb2ad244fbd2a595825cdee1fc1.zip tk-bdc95807199b5fb2ad244fbd2a595825cdee1fc1.tar.gz tk-bdc95807199b5fb2ad244fbd2a595825cdee1fc1.tar.bz2 |
Use single-argument "expr" as much as possible. Not complete yet, but most trivial places are done.
Diffstat (limited to 'library/demos')
-rw-r--r-- | library/demos/pendulum.tcl | 16 | ||||
-rw-r--r-- | library/demos/square | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl index d344d8d..6422c67 100644 --- a/library/demos/pendulum.tcl +++ b/library/demos/pendulum.tcl @@ -126,16 +126,16 @@ bind $w.c <ButtonRelease-1> { } bind $w.c <Configure> { %W coords plate 0 25 %w 25 - set home [expr %w/2] - %W coords pivot [expr $home-5] 20 [expr $home+5] 30 + set home [expr {%w/2}] + %W coords pivot [expr {$home-5}] 20 [expr {$home+5}] 30 } bind $w.k <Configure> { - set psh [expr %h/2] - set psw [expr %w/2] - %W coords x_axis 2 $psh [expr %w-2] $psh - %W coords y_axis $psw [expr %h-2] $psw 2 - %W coords label_dtheta [expr $psw-4] 6 - %W coords label_theta [expr %w-6] [expr $psh+4] + set psh [expr {%h/2}] + set psw [expr {%w/2}] + %W coords x_axis 2 $psh [expr {%w-2}] $psh + %W coords y_axis $psw [expr {%h-2}] $psw 2 + %W coords label_dtheta [expr {$psw-4}] 6 + %W coords label_theta [expr {%w-6}] [expr {$psh+4}] } # This procedure is the "business" part of the simulation that does diff --git a/library/demos/square b/library/demos/square index 1d7eb20..6ce91b8 100644 --- a/library/demos/square +++ b/library/demos/square @@ -27,7 +27,7 @@ focus .s proc center {x y} { set a [.s size] - .s position [expr $x-($a/2)] [expr $y-($a/2)] + .s position [expr {$x-($a/2)}] [expr {$y-($a/2)}] } # The procedures below provide a simple form of animation where |