Skip to content

Commit

Permalink
added visual color palette
Browse files Browse the repository at this point in the history
  • Loading branch information
roseman committed Dec 14, 2011
1 parent 11fcf5f commit b08ea91
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sketch.tcl
Expand Up @@ -5,7 +5,11 @@ wtk::bind .c <B1-Motion> {
.c create line $x $y %x %y -fill $color
set x %x; set y %y
}
wtk::grid [wtk::frame .tools] -column 0 -row 1
wtk::grid [wtk::button .tools.black -text Black -command "set color black"] -column 0 -row 0
wtk::grid [wtk::button .tools.blue -text Blue -command "set color blue"] -column 1 -row 0
wtk::grid [wtk::button .tools.red -text Red -command "set color red"] -column 2 -row 0

set colors "black blue red green yellow orange brown"
wtk::grid [wtk::canvas .palette -background #cccccc -width 400 -height 30] -column 0 -row 2
set x 10
foreach i $colors {
.palette bind [.palette create rectangle $x 5 [expr {$x+7}] 25 -fill $i] <1> "set color $i"
incr x 10
}

0 comments on commit b08ea91

Please sign in to comment.