home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tk42r2x.zip / TclTk / lib / tk4.2 / demos / icon.tcl < prev    next >
Text File  |  1999-07-27  |  2KB  |  49 lines

  1. # icon.tcl --
  2. #
  3. # This demonstration script creates a toplevel window containing
  4. # buttons that display bitmaps instead of text.
  5. #
  6. # SCCS: @(#) icon.tcl 1.7 96/04/12 11:54:38
  7.  
  8. set w .icon
  9. catch {destroy $w}
  10. toplevel $w
  11. wm title $w "Iconic Button Demonstration"
  12. wm iconname $w "icon"
  13. positionWindow $w
  14.  
  15. label $w.msg -font $font -wraplength 5i -justify left -text "This window shows three ways of using bitmaps or images in radiobuttons and checkbuttons.  On the left are two radiobuttons, each of which displays a bitmap and an indicator.  In the middle is a checkbutton that displays a different image depending on whether it is selected or not.  On the right is a checkbutton that displays a single bitmap but changes its background color to indicate whether or not it is selected."
  16. pack $w.msg -side top
  17.  
  18. frame $w.buttons
  19. pack $w.buttons -side bottom -fill x -pady 2m
  20. button $w.buttons.dismiss -text Dismiss -command "destroy $w"
  21. button $w.buttons.code -text "See Code" -command "showCode $w"
  22. pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
  23.  
  24. image create bitmap flagup \
  25.     -file [file join $tk_library demos images flagup.bmp] \
  26.     -maskfile [file join $tk_library demos images flagup.bmp]
  27. image create bitmap flagdown \
  28.     -file [file join $tk_library demos images flagdown.bmp] \
  29.     -maskfile [file join $tk_library demos images flagdown.bmp]
  30. frame $w.frame -borderwidth 10
  31. pack $w.frame -side top
  32.  
  33. checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
  34.     -indicatoron 0
  35. $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
  36. checkbutton $w.frame.b2 \
  37.     -bitmap @[file join $tk_library demos images letters.bmp] \
  38.     -indicatoron 0 -selectcolor SeaGreen1
  39. frame $w.frame.left
  40. pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
  41.  
  42. radiobutton $w.frame.left.b3 \
  43.     -bitmap @[file join $tk_library demos images letters.bmp] \
  44.     -variable letters -value full
  45. radiobutton $w.frame.left.b4 \
  46.     -bitmap @[file join $tk_library demos images noletter.bmp] \
  47.     -variable letters -value empty
  48. pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes
  49.