E
Ed Redman
I am still fairly new to ruby/tk
I am trying to translate some simple programs from tcl/tk to ruby/tk.
The following stumps me however. Could someone help me translate.
Specifically, the foreach {x y} [$w coords $item]. The $w refers to
TkcPolygons.
proc poly'rotate {w item angle} {
set delta [expr {$angle/180.*acos(-1)}]
foreach {x y} [$w coords $item] {
set r [expr {hypot($y,$x)}]
set a [expr {atan2($y,$x)+$delta}]
lappend coords [expr {cos($a)*$r}] [expr {sin($a)*$r}]
thank you
I am trying to translate some simple programs from tcl/tk to ruby/tk.
The following stumps me however. Could someone help me translate.
Specifically, the foreach {x y} [$w coords $item]. The $w refers to
TkcPolygons.
proc poly'rotate {w item angle} {
set delta [expr {$angle/180.*acos(-1)}]
foreach {x y} [$w coords $item] {
set r [expr {hypot($y,$x)}]
set a [expr {atan2($y,$x)+$delta}]
lappend coords [expr {cos($a)*$r}] [expr {sin($a)*$r}]
thank you