Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# This file: # http://angg.twu.net/TCL/drag2022.tcl.html # http://angg.twu.net/TCL/drag2022.tcl # (find-angg "TCL/drag2022.tcl") # Author: Eduardo Ochs <eduardoochs@gmail.com> # Based on: (find-anggfile "TCL/dragTs.tcl") # (find-anggfile "TCL/placer.tcl") # Version: 2022mar02 package-require-Tk; # See: (find-es "tcl" "package-require-Tk") canvas .c -width 250 -height 250 pack .c -expand yes -fill both proc dragx {x} { global oldx; set prevx $oldx; set oldx $x; expr $x-$prevx } proc dragy {y} { global oldy; set prevy $oldy; set oldy $y; expr $y-$prevy } proc createletter {x y letter} { .c create text $x $y -text $letter -anchor nw -tags "T${letter}" .c bind T${letter} <B1-Motion> ".c move T${letter} \[dragx %x\] \[dragy %y\]" } lindex {"" {This is a test block: * (eepitch-tclsh) * (eepitch-kill) * (eepitch-tclsh) source drag2022.tcl .c create text 100 100 -text A -anchor nw -tags "TA" .c bind TA <B1-Motion> {puts "%x %y"} .c bind TA <B1-Motion> {puts "%x %y"} .c bind TA <B1-Motion> ".c moveto TA %x %y" .c .c itemconfigure .c itemconfigure TA .c itemcget .c itemcget TA .c itemcget TA foo .c dtag .c cget .c itemcget .c itemcget TA .c gettags .c gettags TA .c imove }} 0 ;# End of the test block # Local Variables: # coding: utf-8-unix # End: