Posted to tcl by kbk at Mon Dec 14 18:33:39 GMT 2009view pretty

package require Tk
grid [canvas .c -width 500 -height 300 -bg white
.c create rectangle 100 100 200 200 -fill blue -outline black -tags a
.c create rectangle 300 100 400 200 -fill red -outline black -tags a
.c bind a <Enter> {puts Enter}
.c bind a <Leave> {puts Leave}

Comments

Posted by lyon at Mon Dec 14 18:35:13 GMT 2009 [text] [code]

canvas .c pack .c -expand 1 -fill both set cid [.c create rectangle 10 10 200 50 -fill red] .c bind $cid <Enter> "puts enter" .c bind $cid <Leave> "puts leave"