bitmap.tcl 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # bitmap.tcl --
  2. #
  3. # This demonstration script creates a toplevel window that displays
  4. # all of Tk's built-in bitmaps.
  5. if {![info exists widgetDemo]} {
  6. error "This script should be run from the \"widget\" demo."
  7. }
  8. package require Tk
  9. # bitmapRow --
  10. # Create a row of bitmap items in a window.
  11. #
  12. # Arguments:
  13. # w - The window that is to contain the row.
  14. # args - The names of one or more bitmaps, which will be displayed
  15. # in a new row across the bottom of w along with their
  16. # names.
  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. set w .bitmap
  31. catch {destroy $w}
  32. toplevel $w
  33. wm title $w "Bitmap Demonstration"
  34. wm iconname $w "bitmap"
  35. positionWindow $w
  36. 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."
  37. pack $w.msg -side top
  38. ## See Code / Dismiss buttons
  39. set btns [addSeeDismiss $w.buttons $w]
  40. pack $btns -side bottom -fill x
  41. frame $w.frame
  42. bitmapRow $w.frame.0 error gray12 gray25 gray50 gray75
  43. bitmapRow $w.frame.1 hourglass info question questhead warning
  44. pack $w.frame -side top -expand yes -fill both