home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / Linux / Pratique / Tcltk / packer.tcl < prev    next >
Text File  |  1997-09-10  |  7KB  |  194 lines

  1.  
  2. ######################################
  3. # packer.tcl                         #
  4. ######################################
  5. # fonctionnement du packer           #
  6. ######################################
  7.  
  8.  
  9. # cadre du haut
  10.  
  11. frame .frame1 -relief sunken -borderwidth 2
  12.  
  13. # label "Widget"
  14.  
  15. label .frame1.label -text "Widget" -relief groove -borderwidth 2
  16.  
  17. # cadre "commandes"
  18.  
  19. frame .frame2 -relief flat -borderwidth 1
  20.  
  21. # cadre "Side"
  22.  
  23. set SideMode "top"
  24.  
  25. frame .frame2.frame0 -relief raised -borderwidth 2
  26. label .frame2.frame0.label -text "Side" -relief groove -borderwidth 2
  27. radiobutton .frame2.frame0.topbtn -text "Top" -variable SideMode -value "top" -command UpdateWidget 
  28. radiobutton .frame2.frame0.leftbtn -text "Left" -variable SideMode -value "left" -command UpdateWidget 
  29. radiobutton .frame2.frame0.rightbtn -text "Right" -variable SideMode -value "right" -command UpdateWidget 
  30. radiobutton .frame2.frame0.bottombtn -text "Bottom" -variable SideMode -value "bottom" -command UpdateWidget 
  31.  
  32.  
  33. # cadre "Fill"
  34.  
  35. set FillMode "none"
  36.  
  37. frame .frame2.frame1 -relief raised -borderwidth 2
  38. label .frame2.frame1.label -text "Fill" -relief groove -borderwidth 2
  39. radiobutton .frame2.frame1.nonebtn -text "None" -variable FillMode -value "none" -command UpdateWidget 
  40. radiobutton .frame2.frame1.xbtn -text "X" -variable FillMode -value "x" -command UpdateWidget
  41. radiobutton .frame2.frame1.ybtn -text "Y" -variable FillMode -value "y" -command UpdateWidget
  42. radiobutton .frame2.frame1.bothbtn -text "Both" -variable FillMode -value "both" -command UpdateWidget
  43.  
  44. # cadre "Expand"
  45.  
  46. set ExpandMode "false"
  47.  
  48. frame .frame2.frame2 -relief raised -borderwidth 2
  49. label .frame2.frame2.label -text "Expand" -relief groove -borderwidth 2
  50. radiobutton .frame2.frame2.truebtn -text "True" -variable ExpandMode -value "true" -command UpdateWidget
  51. radiobutton .frame2.frame2.falsebtn -text "False" -variable ExpandMode -value "false" -command UpdateWidget
  52.  
  53. # cadre "external padding"
  54.  
  55. set PadX "0"
  56. set PadY "0"
  57.  
  58.  
  59.  
  60. frame .frame2.frame3 -relief raised -borderwidth 2
  61. label .frame2.frame3.label -text "External Padding" -relief groove -borderwidth 2
  62. scale .frame2.frame3.padxscl -from "0" -to "80" -label "PadX" -showvalue "true" -variable PadX  -orient "horizontal" -borderwidth 2 -relief raised  -command UpdateWidgetScale
  63. scale .frame2.frame3.padyscl -from "0" -to "80" -label "PadY" -showvalue "true" -variable PadY  -orient "horizontal" -borderwidth 2 -relief raised  -command UpdateWidgetScale
  64.  
  65. # cadre "internal padding"
  66.  
  67. set InPadX "0"
  68. set InPadY "0"
  69.  
  70. frame .frame2.frame4 -relief raised -borderwidth 2
  71. label .frame2.frame4.label -text "Internal Padding" -relief groove -borderwidth 2
  72.  
  73. scale .frame2.frame4.ipadxscl -from "0" -to "80" -label "IPadX" -showvalue "true" -variable IPadX  -orient "horizontal" -borderwidth 2 -relief raised  -command UpdateWidgetScale
  74. scale .frame2.frame4.ipadyscl -from "0" -to "80" -label "IPadY" -showvalue "true" -variable IPadY  -orient "horizontal" -borderwidth 2 -relief raised  -command UpdateWidgetScale
  75.  
  76. # cadre "anchor"
  77.  
  78. set AnchorMode "center"
  79.  
  80. frame .frame2.frame5 -relief raised -borderwidth 2
  81. label .frame2.frame5.label -text "Anchor" -relief groove -borderwidth 2
  82. radiobutton .frame2.frame5.nbtn -text "North" -variable AnchorMode -value "n"  -command UpdateWidget
  83. radiobutton .frame2.frame5.nwbtn -text "North West" -variable AnchorMode -value "nw" -command UpdateWidget
  84. radiobutton .frame2.frame5.nebtn -text "North East" -variable AnchorMode -value "ne" -command UpdateWidget
  85. radiobutton .frame2.frame5.centerbtn -text "Center" -variable AnchorMode -value "center" -command UpdateWidget
  86. radiobutton .frame2.frame5.wbtn -text "West" -variable AnchorMode -value "w" -command UpdateWidget
  87. radiobutton .frame2.frame5.ebtn -text "East" -variable AnchorMode -value "e" -command UpdateWidget
  88. radiobutton .frame2.frame5.swbtn -text "South West" -variable AnchorMode -value "sw" -command UpdateWidget
  89. radiobutton .frame2.frame5.sebtn -text "South East" -variable AnchorMode -value "se" -command UpdateWidget
  90. radiobutton .frame2.frame5.sbtn -text "South" -variable AnchorMode -value "s" -command UpdateWidget
  91.  
  92. # cadre "Commandes"
  93.  
  94. frame .frame2.frame6 -relief raised -borderwidth 2
  95. label .frame2.frame6.label -text "Commands" -relief groove -borderwidth 2
  96.  
  97. button .frame2.frame6.quitbtn -text "Quit" -command exit 
  98.  
  99.  
  100. # cadre "Infos"
  101.  
  102. set InfoMessage "Starting packer.tcl ..."
  103.  
  104. frame .frame3 -relief sunken -borderwidth 2
  105. label .frame3.message -textvariable InfoMessage
  106.  
  107.  
  108. # procedure de mise a jour
  109.  
  110. proc UpdateWidget {} {
  111.  
  112.     global SideMode FillMode ExpandMode PadX PadY IPadX IPadY AnchorMode InfoMessage
  113.  
  114.     pack configure .frame1.label -side $SideMode -fill $FillMode -expand $ExpandMode -padx $PadX -pady $PadY -ipadx $IPadX -ipady $IPadY -anchor $AnchorMode
  115.  
  116.     set InfoMessage "pack configure .label -side $SideMode -fill $FillMode -expand $ExpandMode -anchor $AnchorMode -padx $PadX -pady $PadY -ipadx $IPadX -ipady $IPadY"
  117.  
  118.     update
  119.  
  120. }
  121.  
  122. proc UpdateWidgetScale { arg1} {
  123.     UpdateWidget
  124. }
  125.  
  126.  
  127. # Fenetre principale
  128.  
  129. wm title . "Packer demo"
  130. wm geometry . 680x460
  131.  
  132. # Affichage des widgets
  133.  
  134. pack .frame1 -side top -expand true -fill both
  135. pack .frame1.label -fill $FillMode -expand $ExpandMode
  136.  
  137. pack .frame2 -side top -fill x
  138.  
  139. pack .frame2.frame0 -side left -anchor s
  140. pack .frame2.frame0.label -side top -fill x
  141. pack .frame2.frame0.topbtn -side top -fill x
  142. pack .frame2.frame0.leftbtn -side top -fill x
  143. pack .frame2.frame0.rightbtn -side top -fill x
  144. pack .frame2.frame0.bottombtn -side top -fill x
  145.  
  146. pack .frame2.frame1 -side left -anchor s
  147. pack .frame2.frame1.label -side top -fill x
  148. pack .frame2.frame1.nonebtn -side top -fill x
  149. pack .frame2.frame1.xbtn -side top -fill x
  150. pack .frame2.frame1.ybtn -side top -fill x
  151. pack .frame2.frame1.bothbtn -side top -fill x
  152.  
  153. pack .frame2.frame2 -side left -anchor s
  154. pack .frame2.frame2.label -side top -fill x
  155. pack .frame2.frame2.truebtn -side top -fill x
  156. pack .frame2.frame2.falsebtn -side top -fill x
  157.  
  158. pack .frame2.frame3 -side left -anchor s
  159. pack .frame2.frame3.label -side top -fill x
  160. pack .frame2.frame3.padxscl -side top -fill x
  161. pack .frame2.frame3.padyscl -side top -fill x
  162.  
  163. pack .frame2.frame4 -side left -anchor s
  164. pack .frame2.frame4.label -side top -fill x
  165. pack .frame2.frame4.ipadxscl -side top -fill x
  166. pack .frame2.frame4.ipadyscl -side top -fill x
  167.  
  168. pack .frame2.frame5 -side left -anchor n
  169. pack .frame2.frame5.label -side top -fill x
  170. pack .frame2.frame5.nbtn -side top -fill x
  171. pack .frame2.frame5.nwbtn -side top -fill x
  172. pack .frame2.frame5.nebtn -side top -fill x
  173. pack .frame2.frame5.centerbtn -side top -fill x
  174. pack .frame2.frame5.wbtn -side top -fill x
  175. pack .frame2.frame5.ebtn -side top -fill x
  176. pack .frame2.frame5.swbtn -side top -fill x
  177. pack .frame2.frame5.sebtn -side top -fill x
  178. pack .frame2.frame5.sbtn -side top -fill x
  179.  
  180. pack .frame2.frame6 -side right -anchor se
  181. pack .frame2.frame6.label -side top -fill x
  182. pack .frame2.frame6.quitbtn -side top -fill x
  183.  
  184. pack .frame3 -side bottom -anchor s -fill x
  185. pack .frame3.message -side left
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.