summaryrefslogtreecommitdiff
path: root/ext/tk/sample/demos-jp/hscale.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/demos-jp/hscale.rb')
-rw-r--r--ext/tk/sample/demos-jp/hscale.rb27
1 files changed, 14 insertions, 13 deletions
diff --git a/ext/tk/sample/demos-jp/hscale.rb b/ext/tk/sample/demos-jp/hscale.rb
index b636f0579f..5615aa50bd 100644
--- a/ext/tk/sample/demos-jp/hscale.rb
+++ b/ext/tk/sample/demos-jp/hscale.rb
@@ -12,8 +12,9 @@ $hscale_demo = TkToplevel.new {|w|
}
positionWindow($hscale_demo)
+base_frame = TkFrame.new($hscale_demo).pack(:fill=>:both, :expand=>true)
-msg = TkLabel.new($hscale_demo) {
+msg = TkLabel.new(base_frame) {
font $font
wraplength '3.5i'
justify 'left'
@@ -23,7 +24,7 @@ msg = TkLabel.new($hscale_demo) {
}
msg.pack('side'=>'top')
-TkFrame.new($hscale_demo) {|frame|
+TkFrame.new(base_frame) {|frame|
TkButton.new(frame) {
#text 'λ²ò'
text 'ÊĤ¸¤ë'
@@ -40,7 +41,17 @@ TkFrame.new($hscale_demo) {|frame|
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
-TkFrame.new($hscale_demo) {|frame|
+def setWidth(w, width)
+ width = width + 21
+ x2 = width - 30
+ if x2 < 21
+ x2 = 21
+ end
+ w.coords 'poly',20,15,20,35,x2,35,x2,45,width,25,x2,5,x2,15,20,15
+ w.coords 'line',20,15,20,35,x2,35,x2,45,width,25,x2,5,x2,15,20,15
+end
+
+TkFrame.new(base_frame) {|frame|
canvas = TkCanvas.new(frame) {|c|
width 50
height 50
@@ -65,13 +76,3 @@ TkFrame.new($hscale_demo) {|frame|
}.pack('side'=>'bottom', 'expand'=>'yes', 'anchor'=>'n')
scale.set 75
}.pack('side'=>'top', 'fill'=>'x')
-
-def setWidth(w, width)
- width = width + 21
- x2 = width - 30
- if x2 < 21
- x2 = 21
- end
- w.coords 'poly',20,15,20,35,x2,35,x2,45,width,25,x2,5,x2,15,20,15
- w.coords 'line',20,15,20,35,x2,35,x2,45,width,25,x2,5,x2,15,20,15
-end