Posted to tcl by dkf at Wed Nov 22 21:16:39 GMT 2017view raw

  1. grid [canvas .c -w 1024 -he 768 -bg #000 -highlightt 0]
  2. set b [.c cr r 0 336 20 432 -f #FFF]
  3. set B [.c cr r 1004 336 1024 432 -f #FFF]
  4. time {.c cr r 504 [incr y 20] 520 [incr y 20] -f #FFF} 20
  5. bind . <Key> {switch %K q {if [lindex [.c coo $b] 1]>0 {.c move $b 0 -20}} a {if [lindex [.c coo $b] 3]<768 {.c move $b 0 20}} p {if [lindex [.c coo $B] 1]>0 {.c move $B 0 -20}} l {if [lindex [.c coo $B] 3]<768 {.c move $B 0 20}} Escape {exit}}
  6. set P [.c cr o 0 0 20 20 -f #FFF]
  7. proc mb {} {global P;.c move $P 20 20;after 100 mb};mb
  8. set 1 [set 2 0]
  9.