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

  1. # bitmap.tcl --
  2. #
  3. # This demonstration script creates a toplevel window that displays
  4. # all of Tk's built-in bitmaps.
  5. #
  6. # @(#) bitmap.tcl 1.2 95/08/28 14:14:08
  7.  
  8. # bitmapRow --
  9. # Create a row of bitmap items in a window.
  10. #
  11. # Arguments:
  12. # w -        The window that is to contain the row.
  13. # args -    The names of one or more bitmaps, which will be displayed
  14. #        in a new row across the bottom of w along with their
  15. #        names.
  16.  
  17. proc bitmapRow {w args} {
  18.     frame $w
  19.     pack $w -side top -fill both
  20.     set i 0
  21.     foreach bitmap $args {
  22.     frame $w.$i
  23.     pack $w.$i -side left -fill both -pady .25c -padx .25c
  24.     label $w.$i.bitmap -bitmap $bitmap
  25.     label $w.$i.label -text $bitmap -width 9
  26.     pack $w.$i.label $w.$i.bitmap -side bottom
  27.     incr i
  28.     }
  29. }
  30.  
  31. set w .bitmap
  32. global tk_library
  33. catch {destroy $w}
  34. toplevel $w
  35. wm title $w "Bitmap Demonstration"
  36. wm iconname $w "bitmap"
  37. positionWindow $w
  38.  
  39. label $w.msg -font $font -wraplength 4i -justify left -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."
  40. pack $w.msg -side top
  41.  
  42. frame $w.buttons
  43. pack  $w.buttons -side bottom -expand y -fill x -pady 2m
  44. button $w.buttons.dismiss -text Dismiss -command "destroy $w"
  45. button $w.buttons.code -text "See Code" -command "showCode $w"
  46. pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
  47.  
  48. frame $w.frame
  49. bitmapRow $w.frame.0 error gray12 gray50 hourglass
  50. bitmapRow $w.frame.1 info question questhead warning
  51. pack $w.frame -side top -expand yes -fill both
  52.