home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / tk / demos / color < prev    next >
Encoding:
Text File  |  1995-07-21  |  1010 b   |  33 lines

  1. #!/usr/skunk/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. scale .red -command "color red" -label "Red Intensity"  -from 0 -to 255 \
  16.     -orient horizontal -bg "#ffaeb9" -length 250
  17. scale .green -command "color green" -label "Green Intensity" -from 0 -to 255 \
  18.     -orient horizontal -bg "#43cd80"
  19. scale .blue -command "color blue" -label "Blue Intensity" -from 0 -to 255 \
  20.     -orient horizontal -bg "#7ec0ee"
  21. pack .red .green .blue -side top -expand yes -fill both
  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 .
  33.