Version 0 of Click me

Updated 2003-02-18 20:02:44

Richard Suchenwirth 2003-02-18 - Reading a Java tutorial in a bored moment, I came upon the ClickMe example at , where with only two Java class files, in less than 40 LOC, you can implement a rectangle where a red spot appears when you click on it. After compilation, you have 5 files (one HTML) that perform this feat.

Hm, thought I, how would that look in Tcl?

 package require Tk
 proc drawSpot {w x y} {
    $w delete spot
    set r 7
    $w create oval [expr {$x-$r}] [expr {$y-$r}] [expr {$x+$r}] [expr {$y+$r}]\
        -fill red -outline red -tag spot
 pack [canvas .c]
 .c create rect 5 5 205 205 -fill white -outline black -tag box
 .c bind box <1> {drawSpot %W %x %y}

Arts and crafts of Tcl-Tk programming