home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Programming in Tcl & Tk (4th Edition)
/
TCLBOOK4.BIN
/
pc
/
exsource
/
37_11.tcl
< prev
next >
Wrap
Text File
|
2003-04-16
|
428b
|
24 lines
#
# Example 37-11
# Dragging out a box.
#
proc BoxInit {} {
canvas .c -bg white ; pack .c
bind .c <Button-1> {BoxBegin %W %x %y}
bind .c <B1-Motion> {BoxDrag %W %x %y}
}
proc BoxBegin { w x y } {
global box
set box($w,anchor) [list $x $y]
catch {unset box($w,last)}
}
proc BoxDrag { w x y } {
global box
catch {$w delete $box($w,last)}
set box($w,last) [eval {$w create rect} $box($w,anchor) \
{$x $y -tag box}]
}