]> git.zerfleddert.de Git - micropolis/blob - src/tk/library/demos/color
Import Micropolis from http://www.donhopkins.com/home/micropolis/
[micropolis] / src / tk / library / demos / color
1 #!/usr/local/bin/wish -f
2 #
3 # Simple script to change colors of a window.
4
5 if "$argc < 3" {error "Usage: color appName window option"}
6 set appName [lindex $argv 0]
7 set widget [lindex $argv 1]
8 set option [lindex $argv 2]
9 set red 0
10 set green 0
11 set blue 0
12
13 option add *Scale.sliderForeground "#cdb79e"
14 option add *Scale.activeForeground "#ffe4c4"
15 pack append . [scale .red -command "color red" -label "Red Intensity" \
16 -from 0 -to 255 -orient horizontal -bg "#ffaeb9" -length 250] \
17 {top expand fill}
18 pack append . [scale .green -command "color green" -label "Green Intensity" \
19 -from 0 -to 255 -orient horizontal -bg "#43cd80"] {top expand fill}
20 pack append . [scale .blue -command "color blue" -label "Blue Intensity" \
21 -from 0 -to 255 -orient horizontal -bg "#7ec0ee"] {top expand fill}
22
23 proc color {which intensity} {
24 global red green blue appName widget option
25 set $which $intensity
26 send $appName $widget config $option \
27 [format #%02x%02x%02x $red $green $blue]
28 }
29
30 bind . <Control-q> {destroy .}
31 bind . <Control-c> {destroy .}
32 focus .
Impressum, Datenschutz