### Rubber banding

canvas .c1
pack append . .c1 {top expand fill}

.c1 create rectangle 20 20 80 80 -fill red
.c1 create rectangle 60 60 120 120 -fill green
.c1 create rectangle 40 40 100 100 -fill blue

bind .c1 <ButtonPress-1> ".c1 create rectangle %x %y %x %y -tags band"

bind .c1 <B1-Motion> {
        set cor [lreplace [.c1 coords band] 2 3 %x %y]
        eval ".c1 coords band $cor"
}

bind .c1 <ButtonRelease-1> {puts stdout [.c1 coords band]; .c1 delete band}
