gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.9KB

  1. # -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
  2. #
  3. # $Id: Xpm.tcl,v 1.3 2001/12/09 05:31:07 idiscovery Exp $
  4. #
  5. # Tix Demostration Program
  6. #
  7. # This sample program is structured in such a way so that it can be
  8. # executed from the Tix demo program "widget": it must have a
  9. # procedure called "RunSample". It should also have the "if" statment
  10. # at the end of this file so that it can be run as a standalone
  11. # program using tixwish.
  12. # This file demonstrates the use of XPM images.
  13. #
  14. proc RunSample {w} {
  15. set hard_disk_pixmap {/* XPM */
  16. static char * drivea_xpm[] = {
  17. /* width height ncolors chars_per_pixel */
  18. "32 32 5 1",
  19. /* colors */
  20. " s None c None",
  21. ". c #000000000000",
  22. "X c white",
  23. "o c #c000c000c000",
  24. "O c #800080008000",
  25. /* pixels */
  26. " ",
  27. " ",
  28. " ",
  29. " ",
  30. " ",
  31. " ",
  32. " ",
  33. " ",
  34. " ",
  35. " .......................... ",
  36. " .XXXXXXXXXXXXXXXXXXXXXXXo. ",
  37. " .XooooooooooooooooooooooO. ",
  38. " .Xooooooooooooooooo..oooO. ",
  39. " .Xooooooooooooooooo..oooO. ",
  40. " .XooooooooooooooooooooooO. ",
  41. " .Xoooooooo.......oooooooO. ",
  42. " .Xoo...................oO. ",
  43. " .Xoooooooo.......oooooooO. ",
  44. " .XooooooooooooooooooooooO. ",
  45. " .XooooooooooooooooooooooO. ",
  46. " .XooooooooooooooooooooooO. ",
  47. " .XooooooooooooooooooooooO. ",
  48. " .oOOOOOOOOOOOOOOOOOOOOOOO. ",
  49. " .......................... ",
  50. " ",
  51. " ",
  52. " ",
  53. " ",
  54. " ",
  55. " ",
  56. " ",
  57. " "};
  58. }
  59. frame $w.top -relief raised -bd 1
  60. button $w.top.b -image [image create pixmap -data $hard_disk_pixmap]
  61. pack $w.top -expand yes -fill both
  62. pack $w.top.b -expand yes -padx 20 -pady 20
  63. tixButtonBox $w.box -orientation horizontal
  64. $w.box add ok -text Ok -underline 0 -command "destroy $w" \
  65. -width 6
  66. $w.box add cancel -text Cancel -underline 0 -command "destroy $w" \
  67. -width 6
  68. pack $w.box -side bottom -fill x
  69. pack $w.top -side top -fill both -expand yes
  70. }
  71. # This "if" statement makes it possible to run this script file inside or
  72. # outside of the main demo program "widget".
  73. #
  74. if {![info exists tix_demo_running]} {
  75. wm withdraw .
  76. set w .demo
  77. toplevel $w; wm transient $w ""
  78. RunSample $w
  79. bind $w <Destroy> exit
  80. }
上海开阖软件有限公司 沪ICP备12045867号-1