home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09962.iso / vrml / cp2b2x.exe / DATA.Z / icon.tcl < prev    next >
Text File  |  1996-04-23  |  2KB  |  44 lines

  1. # icon.tcl --
  2. #
  3. # This demonstration script creates a toplevel window containing
  4. # buttons that display bitmaps instead of text.
  5. #
  6. # @(#) icon.tcl 1.3 95/10/04 15:00:42
  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 -expand y -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 -file $tk_library/demos/images/flagup.bmp \
  25.     -maskfile $tk_library/demos/images/flagup.bmp
  26. image create bitmap flagdown -file $tk_library/demos/images/flagdown.bmp \
  27.     -maskfile $tk_library/demos/images/flagdown.bmp
  28. frame $w.frame -borderwidth 10
  29. pack $w.frame -side top
  30.  
  31. checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
  32.     -indicatoron 0
  33. $w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
  34. checkbutton $w.frame.b2 -bitmap @$tk_library/demos/images/letters.bmp \
  35.     -indicatoron 0 -selectcolor SeaGreen1
  36. frame $w.frame.left
  37. pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
  38.  
  39. radiobutton $w.frame.left.b3 -bitmap @$tk_library/demos/images/letters.bmp \
  40.     -variable letters -value full
  41. radiobutton $w.frame.left.b4 -bitmap @$tk_library/demos/images/noletter.bmp \
  42.     -variable letters -value empty
  43. pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes
  44.