From 287a34ae0dfc23e4158f67cb7783d239f202c368 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 6 Mar 2009 03:56:38 +0000 Subject: * {ext,lib,test}/**/*.rb: removed trailing spaces. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/sample/demos-en/anilabel.rb | 14 +- ext/tk/sample/demos-en/aniwave.rb | 10 +- ext/tk/sample/demos-en/arrow.rb | 66 ++-- ext/tk/sample/demos-en/bind.rb | 34 +-- ext/tk/sample/demos-en/bitmap.rb | 8 +- ext/tk/sample/demos-en/button.rb | 10 +- ext/tk/sample/demos-en/check.rb | 10 +- ext/tk/sample/demos-en/check2.rb | 34 +-- ext/tk/sample/demos-en/clrpick.rb | 8 +- ext/tk/sample/demos-en/colors.rb | 2 +- ext/tk/sample/demos-en/combo.rb | 40 +-- ext/tk/sample/demos-en/cscroll.rb | 26 +- ext/tk/sample/demos-en/ctext.rb | 44 +-- ext/tk/sample/demos-en/entry1.rb | 6 +- ext/tk/sample/demos-en/entry2.rb | 4 +- ext/tk/sample/demos-en/entry3.rb | 28 +- ext/tk/sample/demos-en/filebox.rb | 32 +- ext/tk/sample/demos-en/floor.rb | 550 +++++++++++++++++----------------- ext/tk/sample/demos-en/floor2.rb | 550 +++++++++++++++++----------------- ext/tk/sample/demos-en/form.rb | 6 +- ext/tk/sample/demos-en/goldberg.rb | 402 ++++++++++++------------- ext/tk/sample/demos-en/icon.rb | 4 +- ext/tk/sample/demos-en/image1.rb | 2 +- ext/tk/sample/demos-en/image2.rb | 6 +- ext/tk/sample/demos-en/image3.rb | 16 +- ext/tk/sample/demos-en/items.rb | 86 +++--- ext/tk/sample/demos-en/knightstour.rb | 32 +- ext/tk/sample/demos-en/label.rb | 16 +- ext/tk/sample/demos-en/labelframe.rb | 14 +- ext/tk/sample/demos-en/mclist.rb | 56 ++-- ext/tk/sample/demos-en/menu.rb | 48 +-- ext/tk/sample/demos-en/menu84.rb | 60 ++-- ext/tk/sample/demos-en/menubu.rb | 4 +- ext/tk/sample/demos-en/msgbox.rb | 24 +- ext/tk/sample/demos-en/msgbox2.rb | 24 +- ext/tk/sample/demos-en/paned1.rb | 8 +- ext/tk/sample/demos-en/paned2.rb | 46 +-- ext/tk/sample/demos-en/pendulum.rb | 32 +- ext/tk/sample/demos-en/plot.rb | 30 +- ext/tk/sample/demos-en/puzzle.rb | 6 +- ext/tk/sample/demos-en/radio.rb | 12 +- ext/tk/sample/demos-en/radio2.rb | 28 +- ext/tk/sample/demos-en/radio3.rb | 50 ++-- ext/tk/sample/demos-en/ruler.rb | 36 +-- ext/tk/sample/demos-en/sayings.rb | 8 +- ext/tk/sample/demos-en/search.rb | 32 +- ext/tk/sample/demos-en/spin.rb | 16 +- ext/tk/sample/demos-en/states.rb | 22 +- ext/tk/sample/demos-en/style.rb | 38 +-- ext/tk/sample/demos-en/text.rb | 6 +- ext/tk/sample/demos-en/textpeer.rb | 8 +- ext/tk/sample/demos-en/toolbar.rb | 32 +- ext/tk/sample/demos-en/tree.rb | 26 +- ext/tk/sample/demos-en/ttkbut.rb | 48 +-- ext/tk/sample/demos-en/ttkmenu.rb | 18 +- ext/tk/sample/demos-en/ttknote.rb | 22 +- ext/tk/sample/demos-en/ttkpane.rb | 46 +-- ext/tk/sample/demos-en/ttkprogress.rb | 22 +- ext/tk/sample/demos-en/twind.rb | 60 ++-- ext/tk/sample/demos-en/twind2.rb | 130 ++++---- ext/tk/sample/demos-en/unicodeout.rb | 40 +-- 61 files changed, 1549 insertions(+), 1549 deletions(-) (limited to 'ext/tk/sample/demos-en') diff --git a/ext/tk/sample/demos-en/anilabel.rb b/ext/tk/sample/demos-en/anilabel.rb index 0b9bc7357e..ebd84accd2 100644 --- a/ext/tk/sample/demos-en/anilabel.rb +++ b/ext/tk/sample/demos-en/anilabel.rb @@ -4,7 +4,7 @@ # based on Tcl/Tk8.5a2 widget demos if defined?($anilabel_demo) && $anilabel_demo - $anilabel_demo.destroy + $anilabel_demo.destroy $anilabel_demo = nil end @@ -47,7 +47,7 @@ TkFrame.new(base_frame) {|frame| # create frame for label demo f_left = TkLabelFrame.new(base_frame, :text=>'Scrolling Texts') f_right = TkLabelFrame.new(base_frame, :text=>'GIF Image') -Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', +Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', 'padx'=>10, 'pady'=>10) # animated label @@ -85,7 +85,7 @@ class AnimatedImageLabel < AnimatedTextLabel @btag.bind_append('Destroy'){ if @destroy_image begin - self.image.delete + self.image.delete rescue end end @@ -121,13 +121,13 @@ class AnimatedImageLabel < AnimatedTextLabel end # create labels -l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, +l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, :font=>{:family=>'Courier', :size=>10}) -l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, +l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, :font=>{:family=>'Courier', :size=>10}) -l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, +l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, :font=>{:family=>'Courier', :size=>10}, :width=>18) -Tk.pack(l1, l2, l3, +Tk.pack(l1, l2, l3, :side=>:top, :expand=>true, :anchor=>:w, :padx=>10, :pady=>10) limg = AnimatedImageLabel.new(f_right, :borderwidth=>0) diff --git a/ext/tk/sample/demos-en/aniwave.rb b/ext/tk/sample/demos-en/aniwave.rb index 63a04a7b98..57d58193f6 100644 --- a/ext/tk/sample/demos-en/aniwave.rb +++ b/ext/tk/sample/demos-en/aniwave.rb @@ -5,7 +5,7 @@ # destroy toplevel widget for this demo script if defined?($aniwave_demo) && $aniwave_demo - $aniwave_demo.destroy + $aniwave_demo.destroy $aniwave_demo = nil end @@ -51,11 +51,11 @@ class AnimatedWaveDemo @direction = dir # create canvas widget - @c = TkCanvas.new(frame, :width=>300, :height=>200, + @c = TkCanvas.new(frame, :width=>300, :height=>200, :background=>'black') @c.pack(:padx=>10, :pady=>10, :expand=>true) - # Creates a coordinates list of a wave. + # Creates a coordinates list of a wave. @waveCoords = [] @backupCoords = [] n = 0 @@ -67,10 +67,10 @@ class AnimatedWaveDemo # Create a smoothed line and arrange for its coordinates to be the # contents of the variable waveCoords. - @line = TkcLine.new(@c, @waveCoords, + @line = TkcLine.new(@c, @waveCoords, :width=>1, :fill=>'green', :smooth=>true) - # Main animation "loop". + # Main animation "loop". # Theoretically 100 frames-per-second (==10ms between frames) @timer = TkTimer.new(10){ basicMotion; reverser } diff --git a/ext/tk/sample/demos-en/arrow.rb b/ext/tk/sample/demos-en/arrow.rb index 055cd2af3c..452153d010 100644 --- a/ext/tk/sample/demos-en/arrow.rb +++ b/ext/tk/sample/demos-en/arrow.rb @@ -28,65 +28,65 @@ def arrowSetup(c) # Create the arrow and outline. c.delete('all') - TkcLine.new(c, v.x1, v.y, v.x2, v.y, - { 'width'=>10 * v.width, - 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], - 'arrow'=>'last' + TkcLine.new(c, v.x1, v.y, v.x2, v.y, + { 'width'=>10 * v.width, + 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], + 'arrow'=>'last' }.update(v.bigLineStyle) ) xtip = v.x2 - 10*v.b deltaY = 10*v.c + 5*v.width - TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, - v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, + TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, + v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round') # Create the boxes for reshaping the line and arrowhead. - TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, + TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, + TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, + TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) ) c.itemconfigure cur, v.activeStyle if cur # Create three arrows in actual size with the same parameters TkcLine.new(c, v.x2+50, 0, v.x2+50, 1000, 'width'=>2) tmp = v.x2+100 - TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, + TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - # Create a bunch of other arrows and text items showing the + # Create a bunch of other arrows and text items showing the # current dimensions. tmp = v.x2+10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2+15, v.y-deltaY+5*v.c, 'text'=>v.c, 'anchor'=>'w') tmp = v.x1-10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x1-15, v.y, 'text'=>v.width, 'anchor'=>'e') tmp = v.y+5*v.width+10*v.c+10 - TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.a, tmp+5, 'text'=>v.a, 'anchor'=>'n') tmp = tmp+25 - TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.b, tmp+5, 'text'=>v.b, 'anchor'=>'n') if $tk_version =~ /^4.*/ - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]",'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') else - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'Helvetica 18') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w', 'font'=>'Helvetica 18') end @@ -96,7 +96,7 @@ end # toplevel widget if defined?($arrow_demo) && $arrow_demo - $arrow_demo.destroy + $arrow_demo.destroy $arrow_demo = nil end @@ -110,7 +110,7 @@ $arrow_demo = TkToplevel.new {|w| base_frame = TkFrame.new($arrow_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."){ pack('side'=>'top') } @@ -133,15 +133,15 @@ $arrow_buttons = TkFrame.new(base_frame) {|frame| } $arrow_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas -$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, +# canvas +$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, 'relief'=>'sunken', 'borderwidth'=>2) $arrow_canvas.pack('expand'=>'yes', 'fill'=>'both') -# +# unless Struct.const_defined?("ArrowInfo") - $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, - :x1, :x2, :y, :smallTips, :count, + $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, + :x1, :x2, :y, :smallTips, :count, :bigLineStyle, :boxStyle, :activeStyle).new end $demo_arrowInfo.a = 8 @@ -159,7 +159,7 @@ if TkWinfo.depth($arrow_canvas) > 1 $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'red', 'outline'=>'black', 'width'=>1} else - $demo_arrowInfo.bigLineStyle = {'fill'=>'black', + $demo_arrowInfo.bigLineStyle = {'fill'=>'black', 'stipple'=>'@'+[$demo_dir,'..','images','grey.25'].join(File::Separator)} $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'black','outline'=>'black','width'=>1} @@ -170,16 +170,16 @@ $arrowTag_box.bind('Enter', proc{$arrow_canvas.itemconfigure('current', $demo_ar $arrowTag_box.bind('Leave', proc{$arrow_canvas.itemconfigure('current', $demo_arrowInfo.boxStyle)}) $arrowTag_box.bind('B1-Enter', proc{}) $arrowTag_box.bind('B1-Leave', proc{}) -$arrow_canvas.itembind('box1', '1', +$arrow_canvas.itembind('box1', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove1 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box2', '1', +$arrow_canvas.itembind('box2', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove2 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box3', '1', +$arrow_canvas.itembind('box3', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove3 $arrow_canvas, x, y}}) -$arrowTag_box.bind('B1-Motion', +$arrowTag_box.bind('B1-Motion', proc{|x,y| $demo_arrowInfo.motionProc.call(x,y)}, "%x %y") $arrow_canvas.bind('Any-ButtonRelease-1', proc{arrowSetup $arrow_canvas}) diff --git a/ext/tk/sample/demos-en/bind.rb b/ext/tk/sample/demos-en/bind.rb index 665592a2bc..c291e4730a 100644 --- a/ext/tk/sample/demos-en/bind.rb +++ b/ext/tk/sample/demos-en/bind.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($bind_demo) && $bind_demo - $bind_demo.destroy + $bind_demo.destroy $bind_demo = nil end @@ -38,15 +38,15 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# bind +# bind def tag_binding_for_bind_demo(tag, enter_style, leave_style) tag.bind('Any-Enter', proc{tag.configure enter_style}) tag.bind('Any-Leave', proc{tag.configure leave_style}) end -# text +# text txt = TkText.new(base_frame){|t| - # + # setgrid 'true' #width 60 #height 24 @@ -59,9 +59,9 @@ txt = TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # if TkWinfo.depth($root).to_i > 1 - tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', + tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', 'borderwidth'=>1} tagstyle_normal = {'background'=>'', 'relief'=>'flat'} else @@ -77,44 +77,44 @@ txt = TkText.new(base_frame){|t| insert('end', "\n\n") insert('end', '2. A simple two-dimensional plot that allows you to adjust the positions of the data points.', (d2 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '3. Anchoring and justification modes for text items.', + insert('end', '3. Anchoring and justification modes for text items.', (d3 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '4. An editor for arrow-head shapes for line items.', + insert('end', '4. An editor for arrow-head shapes for line items.', (d4 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '5. A ruler with facilities for editing tab stops.', + insert('end', '5. A ruler with facilities for editing tab stops.', (d5 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', - '6. A grid that demonstrates how canvases can be scrolled.', + insert('end', + '6. A grid that demonstrates how canvases can be scrolled.', (d6 = TkTextTag.new(t)) ) # binding [d1, d2, d3, d4, d5, d6].each{|tag| tag_binding_for_bind_demo(tag, tagstyle_bold, tagstyle_normal) } - d1.bind('1', + d1.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'items.rb'].join(File::Separator)}`, 'items.rb') }) - d2.bind('1', + d2.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`, 'plot.rb') }) - d3.bind('1', + d3.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`, 'ctext.rb') }) - d4.bind('1', + d4.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`, 'arrow.rb') }) - d5.bind('1', + d5.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`, 'ruler.rb') }) - d6.bind('1', + d6.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`, 'cscroll.rb') }) diff --git a/ext/tk/sample/demos-en/bitmap.rb b/ext/tk/sample/demos-en/bitmap.rb index 133adb0543..858d067d0d 100644 --- a/ext/tk/sample/demos-en/bitmap.rb +++ b/ext/tk/sample/demos-en/bitmap.rb @@ -17,7 +17,7 @@ def bitmapRow(w,*args) TkFrame.new(w){|row| pack('side'=>'top', 'fill'=>'both') - for bitmap in args + for bitmap in args TkFrame.new(row){|base| pack('side'=>'left', 'fill'=>'both', 'pady'=>'.25c', 'padx'=>'.25c') TkLabel.new(base, 'text'=>bitmap, 'width'=>9).pack('side'=>'bottom') @@ -29,7 +29,7 @@ end # toplevel widget if defined?($bitmap_demo) && $bitmap_demo - $bitmap_demo.destroy + $bitmap_demo.destroy $bitmap_demo = nil end @@ -43,7 +43,7 @@ $bitmap_demo = TkToplevel.new {|w| base_frame = TkFrame.new($bitmap_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', +TkLabel.new(base_frame,'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."){ pack('side'=>'top') } @@ -66,7 +66,7 @@ $bitmap_buttons = TkFrame.new(base_frame) {|frame| } $bitmap_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame TkFrame.new(base_frame){|f| bitmapRow(f,'error','gray25','gray50','hourglass') bitmapRow(f,'info','question','questhead','warning') diff --git a/ext/tk/sample/demos-en/button.rb b/ext/tk/sample/demos-en/button.rb index 5c03bd499b..f63a2f3b06 100644 --- a/ext/tk/sample/demos-en/button.rb +++ b/ext/tk/sample/demos-en/button.rb @@ -6,20 +6,20 @@ # button widget demo (called by 'widget') # -# toplevel widget +# toplevel widget if defined?($button_demo) && $button_demo - $button_demo.destroy + $button_demo.destroy $button_demo = nil end -# demo toplevel widget +# demo toplevel widget $button_demo = TkToplevel.new {|w| title("Button Demonstration") iconname("button") positionWindow(w) } -# label +# label msg = TkLabel.new($button_demo) { font $kanji_font wraplength '4i' @@ -28,7 +28,7 @@ msg = TkLabel.new($button_demo) { } msg.pack('side'=>'top') -# frame +# frame $button_buttons = Tk::Frame.new($button_demo) {|frame| TkButton.new(frame) { text 'Dismiss' diff --git a/ext/tk/sample/demos-en/check.rb b/ext/tk/sample/demos-en/check.rb index 2951962a79..bf0b73476a 100644 --- a/ext/tk/sample/demos-en/check.rb +++ b/ext/tk/sample/demos-en/check.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($check_demo) && $check_demo - $check_demo.destroy + $check_demo.destroy $check_demo = nil end @@ -21,7 +21,7 @@ $check_demo = TkToplevel.new {|w| base_frame = TkFrame.new($check_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,12 +30,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# wipers = TkVariable.new(0) brakes = TkVariable.new(0) sober = TkVariable.new(0) -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -56,7 +56,7 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'See Variables' command proc{ - showVars(base_frame, + showVars(base_frame, ['wipers', wipers], ['brakes', brakes], ['sober', sober]) } }.pack('side'=>'left', 'expand'=>'yes') diff --git a/ext/tk/sample/demos-en/check2.rb b/ext/tk/sample/demos-en/check2.rb index faea748a87..4f7b1f07bc 100644 --- a/ext/tk/sample/demos-en/check2.rb +++ b/ext/tk/sample/demos-en/check2.rb @@ -4,7 +4,7 @@ # delete old toplevel widget if defined?($check2_demo) && $check2_demo - $check2_demo.destroy + $check2_demo.destroy $check2_demo = nil end @@ -34,35 +34,35 @@ sober = TkVariable.new(0) # frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars($check2_demo, - ['safety', safety], ['wipers', wipers], + showVars($check2_demo, + ['safety', safety], ['wipers', wipers], ['brakes', brakes], ['sober', sober]) - }), - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'check2'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'check2'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $check2_demo $check2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) }.pack('side'=>'bottom', 'fill'=>'x') # checkbutton -TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, - :relief=>:flat, :onvalue=>'all', :offvalue=>'none', +TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, + :relief=>:flat, :onvalue=>'all', :offvalue=>'none', :tristatevalue=>'partial'){ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } @@ -70,7 +70,7 @@ TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, [ TkCheckButton.new(base_frame, 'text'=>'Wipers OK', 'variable'=>wipers), TkCheckButton.new(base_frame, 'text'=>'Brakes OK', 'variable'=>brakes), TkCheckButton.new(base_frame, 'text'=>'Driver Sober', 'variable'=>sober) -].each{|w| +].each{|w| w.relief('flat') w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w') } diff --git a/ext/tk/sample/demos-en/clrpick.rb b/ext/tk/sample/demos-en/clrpick.rb index 431439d55d..6da28cb112 100644 --- a/ext/tk/sample/demos-en/clrpick.rb +++ b/ext/tk/sample/demos-en/clrpick.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($clrpick_demo) && $clrpick_demo - $clrpick_demo.destroy + $clrpick_demo.destroy $clrpick_demo = nil end @@ -47,10 +47,10 @@ Tk::Frame.new($clrpick_demo) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# button +# button # TkButton.new($clrpick_demo, 'text'=>'Set background color ...') {|b| Tk::Button.new($clrpick_demo, 'text'=>'Set background color ...') {|b| - command(proc{setColor $clrpick_demo, b, 'background', + command(proc{setColor $clrpick_demo, b, 'background', ['background', 'highlightbackground']}) pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m') } @@ -64,7 +64,7 @@ Tk::Button.new($clrpick_demo, 'text'=>'Set foreground color ...') {|b| def setColor(w,button,name,options) w.grab initialColor = button[name] - color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, + color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, 'initialcolor'=>initialColor) if color != "" setColor_helper(w,options,color) diff --git a/ext/tk/sample/demos-en/colors.rb b/ext/tk/sample/demos-en/colors.rb index 4300a660ae..b0ef9590b9 100644 --- a/ext/tk/sample/demos-en/colors.rb +++ b/ext/tk/sample/demos-en/colors.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($colors_demo) && $colors_demo - $colors_demo.destroy + $colors_demo.destroy $colors_demo = nil end diff --git a/ext/tk/sample/demos-en/combo.rb b/ext/tk/sample/demos-en/combo.rb index 0907d9e8ec..d77660095c 100644 --- a/ext/tk/sample/demos-en/combo.rb +++ b/ext/tk/sample/demos-en/combo.rb @@ -5,7 +5,7 @@ # based on "Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($combo_demo) && $combo_demo - $combo_demo.destroy + $combo_demo.destroy $combo_demo = nil end @@ -17,7 +17,7 @@ $combo_demo = TkToplevel.new {|w| base_frame = TkFrame.new($combo_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top, :fill=>:x) Three different combo-boxes are displayed below. \ You can add characters to the first \ @@ -40,24 +40,24 @@ ozCity = TkVariable.new Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, - ['firstVariable', firstValue], - ['secondVariable', secondValue], + showVars(base_frame, + ['firstVariable', firstValue], + ['secondVariable', secondValue], ['ozCity', ozCity]) - }), - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'combo'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'combo'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $combo_demo.destroy $combo_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -66,7 +66,7 @@ Ttk::Frame.new(base_frame) {|frame| frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] @@ -80,17 +80,17 @@ Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f| w.values <<= w.value unless w.values.include?(w.value) } }.pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Disabled'){|f| Ttk::Combobox.new(f, :textvariable=>secondValue, :state=>:disabled) . pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Defined List Only'){|f| - Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, + Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, :values=>australianCities) . pack(:pady=>5, :padx=>10) - }, + }, :side=>:top, :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-en/cscroll.rb b/ext/tk/sample/demos-en/cscroll.rb index 259ed3bd8c..40a3afc0ad 100644 --- a/ext/tk/sample/demos-en/cscroll.rb +++ b/ext/tk/sample/demos-en/cscroll.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($cscroll_demo) && $cscroll_demo - $cscroll_demo.destroy + $cscroll_demo.destroy $cscroll_demo = nil end @@ -22,7 +22,7 @@ $cscroll_demo = TkToplevel.new {|w| base_frame = TkFrame.new($cscroll_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"This window displays a canvas widget that can be scrolled either using the scrollbars or by dragging with button 2 in the canvas. If you click button 1 on one of the rectangles, its indices will be printed on stdout."){ pack('side'=>'top') } @@ -45,7 +45,7 @@ $cscroll_buttons = TkFrame.new(base_frame) {|frame| } $cscroll_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame unless $tk_version =~ /^4\.[01]/ $cscroll_grid = TkFrame.new(base_frame) { pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1) @@ -55,14 +55,14 @@ unless $tk_version =~ /^4\.[01]/ end # canvas -$cscroll_canvas = TkCanvas.new(base_frame, +$cscroll_canvas = TkCanvas.new(base_frame, 'relief'=>'sunken', 'borderwidth'=>2, 'scrollregion'=>['-11c', '-11c', '50c', '20c'] ) {|c| if $tk_version =~ /^4\.[01]/ - pack('expand'=>'yes', 'fill'=>'both') + pack('expand'=>'yes', 'fill'=>'both') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end @@ -71,18 +71,18 @@ $cscroll_canvas = TkCanvas.new(base_frame, if $tk_version =~ /^4\.[01]/ pack('side'=>'right', 'fill'=>'y') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}) {|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) if $tk_version =~ /^4\.[01]/ - pack('side'=>'bottom', 'fill'=>'x') + pack('side'=>'bottom', 'fill'=>'x') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } @@ -93,9 +93,9 @@ bg = $cscroll_canvas.configinfo('bg')[4] x = -10+3*i y = -10 (0..9).each{|j| - TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", + TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", 'outline'=>'black', 'fill'=>bg, 'tags'=>'rect') - TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", + TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", 'text'=>"#{i},#{j}", 'anchor'=>'center', 'tags'=>'text') y += 3 } @@ -106,7 +106,7 @@ $cscroll_canvas.itembind('all', 'Any-Leave', proc{scrollLeave $cscroll_canvas}) $cscroll_canvas.itembind('all', '1', proc{scrollButton $cscroll_canvas}) $cscroll_canvas.itembind('all', 'Any-Enter', proc{scrollEnter $cscroll_canvas}) $cscroll_canvas.bind('2', proc{|x,y| $cscroll_canvas.scan_mark(x,y)}, '%x %y') -$cscroll_canvas.bind('B2-Motion', +$cscroll_canvas.bind('B2-Motion', proc{|x,y| $cscroll_canvas.scan_dragto(x,y)}, '%x %y') def scrollEnter(c) diff --git a/ext/tk/sample/demos-en/ctext.rb b/ext/tk/sample/demos-en/ctext.rb index 01374b0321..e04cb283f0 100644 --- a/ext/tk/sample/demos-en/ctext.rb +++ b/ext/tk/sample/demos-en/ctext.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($ctext_demo) && $ctext_demo - $ctext_demo.destroy + $ctext_demo.destroy $ctext_demo = nil end @@ -22,7 +22,7 @@ $ctext_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ctext_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing: 1. You can point, click, and type. 2. You can also select with button 1. @@ -52,20 +52,20 @@ $ctext_buttons = TkFrame.new(base_frame) {|frame| } $ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas -$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', +# canvas +$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', 'borderwidth'=>0, 'width'=>500, 'height'=>350) $ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both') -# font +# font if $tk_version =~ /^4.*/ textFont = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*' else textFont = 'Helvetica 24' end -# canvas -TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, +# canvas +TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, 'outline'=>'black', 'fill'=>'red') ctag_text_param = { @@ -83,24 +83,24 @@ $ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200, ctag_text_param)) $ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") -$ctag_text.bind('Shift-1', - proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, +$ctag_text.bind('Shift-1', + proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, "%x %y") -$ctag_text.bind('Shift-B1-Motion', +$ctag_text.bind('Shift-B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A") $ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"}) $ctag_text.bind('Control-h', proc{textBs $ctext_canvas}) $ctag_text.bind('BackSpace', proc{textBs $ctext_canvas}) $ctag_text.bind('Delete', proc{textDel $ctext_canvas}) -$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, +$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, "%x %y") -# Next, create some items that allow the text's anchor position +# Next, create some items that allow the text's anchor position # to be edited. def mkTextConfig(w,x,y,option,value,color) - item = TkcRectangle.new(w, x, y, x+30, y+30, + item = TkcRectangle.new(w, x, y, x+30, y+30, 'outline'=>'black', 'fill'=>color, 'width'=>1) item.bind('1', proc{$ctag_text.configure option, value}) w.addtag_withtag('config', item) @@ -118,15 +118,15 @@ mkTextConfig $ctext_canvas, x+60, y+30, 'anchor', 'w', color mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color -item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, +item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, 'outline'=>'black', 'fill'=>'red') item.bind('1', proc{$ctag_text.configure 'anchor', 'center'}) if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end @@ -140,18 +140,18 @@ mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end $ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas}) -$ctext_canvas.itembind('config', 'Leave', +$ctext_canvas.itembind('config', 'Leave', proc{$ctext_canvas\ - .itemconfigure('current', + .itemconfigure('current', 'fill'=>$textConfigFill)}) $textConfigFill = '' diff --git a/ext/tk/sample/demos-en/entry1.rb b/ext/tk/sample/demos-en/entry1.rb index 6f5b10fb71..fac0afc243 100644 --- a/ext/tk/sample/demos-en/entry1.rb +++ b/ext/tk/sample/demos-en/entry1.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($entry1_demo) && $entry1_demo - $entry1_demo.destroy + $entry1_demo.destroy $entry1_demo = nil end @@ -43,13 +43,13 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# e1 = TkEntry.new(base_frame, 'relief'=>'sunken') e2 = TkEntry.new(base_frame, 'relief'=>'sunken') e3 = TkEntry.new(base_frame, 'relief'=>'sunken') [e1,e2,e3].each{|w| w.pack('side'=>'top', 'padx'=>10, 'pady'=>5, 'fill'=>'x')} -# +# e1.insert(0, 'Initial value') e2.insert('end', "This entry contains a long value, much too long ") e2.insert('end', "to fit in the window at one time, so long in fact ") diff --git a/ext/tk/sample/demos-en/entry2.rb b/ext/tk/sample/demos-en/entry2.rb index d67d04b56d..05a6c83cfd 100644 --- a/ext/tk/sample/demos-en/entry2.rb +++ b/ext/tk/sample/demos-en/entry2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($entry2_demo) && $entry2_demo - $entry2_demo.destroy + $entry2_demo.destroy $entry2_demo = nil end @@ -82,7 +82,7 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| e3.pack('side'=>'top', 'fill'=>'x') s3.pack('side'=>'top', 'fill'=>'x') - # + # e1.insert(0, 'Initial value') e2.insert('end', "This entry contains a long value, much too long ") e2.insert('end', "to fit in the window at one time, so long in fact ") diff --git a/ext/tk/sample/demos-en/entry3.rb b/ext/tk/sample/demos-en/entry3.rb index f7df3a5653..d3bc629fdf 100644 --- a/ext/tk/sample/demos-en/entry3.rb +++ b/ext/tk/sample/demos-en/entry3.rb @@ -7,7 +7,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($entry3_demo) && $entry3_demo - $entry3_demo.destroy + $entry3_demo.destroy $entry3_demo = nil end @@ -19,8 +19,8 @@ $entry3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($entry3_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top) Four different entries are displayed below. You can add characters \ by pointing, clicking and typing, though each is constrained in what \ @@ -63,8 +63,8 @@ TkFrame.new(base_frame){|f| def focusAndFlash(widget, fg, bg, count=5) return if count <= 0 if fg && !fg.empty? && bg && !bg.empty? - TkTimer.new(200, count, - proc{widget.configure(:foreground=>bg, :background=>fg)}, + TkTimer.new(200, count, + proc{widget.configure(:foreground=>bg, :background=>fg)}, proc{widget.configure(:foreground=>fg, :background=>bg)} ).start else @@ -86,7 +86,7 @@ def focusAndFlash(widget, fg, bg, count=5) end l1 = TkLabelFrame.new(base_frame, :text=>"Integer Entry") -TkEntry.new(l1, :validate=>:focus, +TkEntry.new(l1, :validate=>:focus, :vcmd=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' ]) {|e| @@ -97,7 +97,7 @@ TkEntry.new(l1, :validate=>:focus, } l2 = TkLabelFrame.new(base_frame, :text=>"Length-Constrained Entry") -TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, +TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, :vcmd=>[proc{|s| s.length < 10}, '%P'] ).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') @@ -171,7 +171,7 @@ end def validatePhoneChange(widget, vmode, idx, char) return true if idx == nil - Tk.after_idle(proc{widget.configure(:validate=>vmode, + Tk.after_idle(proc{widget.configure(:validate=>vmode, :invcmd=>proc{Tk.bell})}) if !(idx<3 || idx==6 || idx==7 || idx==11 || idx>15) && char =~ /[0-9A-Za-z]/ widget.delete(idx) @@ -179,17 +179,17 @@ def validatePhoneChange(widget, vmode, idx, char) Tk.after_idle(proc{phoneSkipRight(widget, -1)}) return true # Tk.update(true) # <- Don't work 'update' inter validation callback. - # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). + # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). end return false end l3 = TkLabelFrame.new(base_frame, :text=>"US Phone-Number Entry") -TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, - :textvariable=>entry3content, +TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, + :textvariable=>entry3content, :vcmd=>[ - proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, + proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, "%W %v %i %S" ]){|e| # Click to focus goes to the first editable character... @@ -205,9 +205,9 @@ TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, } l4 = TkLabelFrame.new(base_frame, :text=>"Password Entry") -TkEntry.new(l4, :validate=>:key, :show=>'*', +TkEntry.new(l4, :validate=>:key, :show=>'*', :vcmd=>[ - proc{|s| s.length <= 8}, + proc{|s| s.length <= 8}, '%P' ]).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') diff --git a/ext/tk/sample/demos-en/filebox.rb b/ext/tk/sample/demos-en/filebox.rb index 676c347409..0c284c11d4 100644 --- a/ext/tk/sample/demos-en/filebox.rb +++ b/ext/tk/sample/demos-en/filebox.rb @@ -6,7 +6,7 @@ # toplevel widget if defined?($filebox_demo) && $filebox_demo - $filebox_demo.destroy + $filebox_demo.destroy $filebox_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| TkEntry.new(f, 'width'=>20) {|e| pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') - TkButton.new(f, 'text'=>'Browse ...', + TkButton.new(f, 'text'=>'Browse ...', 'command'=>proc{fileDialog base_frame,e,type})\ .pack('side'=>'left') } @@ -60,9 +60,9 @@ TkFrame.new(base_frame) {|frame| $tk_strictMotif = TkVarAccess.new('tk_strictMotif') if ($tk_platform['platform'] == 'unix') - TkCheckButton.new(base_frame, - 'text'=>'Use Motif Style Dialog', - 'variable'=>$tk_strictMotif, + TkCheckButton.new(base_frame, + 'text'=>'Use Motif Style Dialog', + 'variable'=>$tk_strictMotif, 'onvalue'=>1, 'offvalue'=>0 ).pack('anchor'=>'c') end @@ -71,23 +71,23 @@ def fileDialog(w,ent,operation) # #-------------------------------------------------------- types = [ - ['Text files', ['.txt','.doc'] ], - ['Text files', [], 'TEXT' ], - ['Ruby Scripts', ['.rb'], 'TEXT' ], - ['Tcl Scripts', ['.tcl'], 'TEXT' ], - ['C Source Files', ['.c','.h'] ], - ['All Source Files', ['.rb','.tcl','.c','.h'] ], - ['Image Files', ['.gif'] ], - ['Image Files', ['.jpeg','.jpg'] ], - ['Image Files', [], ['GIFF','JPEG']], + ['Text files', ['.txt','.doc'] ], + ['Text files', [], 'TEXT' ], + ['Ruby Scripts', ['.rb'], 'TEXT' ], + ['Tcl Scripts', ['.tcl'], 'TEXT' ], + ['C Source Files', ['.c','.h'] ], + ['All Source Files', ['.rb','.tcl','.c','.h'] ], + ['Image Files', ['.gif'] ], + ['Image Files', ['.jpeg','.jpg'] ], + ['Image Files', [], ['GIFF','JPEG']], ['All files', '*' ] ] if operation == 'open' file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w) else - file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, - 'initialfile'=>'Untitled', + file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, + 'initialfile'=>'Untitled', 'defaultextension'=>'.txt') end if file != "" diff --git a/ext/tk/sample/demos-en/floor.rb b/ext/tk/sample/demos-en/floor.rb index 7023f2a72e..eb8b23eb7d 100644 --- a/ext/tk/sample/demos-en/floor.rb +++ b/ext/tk/sample/demos-en/floor.rb @@ -21,7 +21,7 @@ def floorDisplay(w,active) w.delete('all') $activeFloor = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor_bg1(w,$floor_colors['bg1'],$floor_colors['outline1']) @@ -32,12 +32,12 @@ def floorDisplay(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. TkcRectangle.new(w,0,100,1,101, 'fill'=>'', 'outline'=>'', 'tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -302,7 +302,7 @@ def floor_bg3(w,fill,outline) TkcLine.new(w,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, + TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -316,316 +316,316 @@ end # color - Color to use for drawing foreground information. def floor_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '101' $floorItems['101'] = i - TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Pub Lift1' $floorItems['Pub Lift1'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Priv Lift1' $floorItems['Priv Lift1'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '110' $floorItems['110'] = i - TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, + TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '109' $floorItems['109'] = i - TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, + TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '111' $floorItems['111'] = i - TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, + TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117B' $floorItems['117B'] = i - TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, + TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '112' $floorItems['112'] = i - TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, + TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '113' $floorItems['113'] = i - TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, + TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117A' $floorItems['117A'] = i - TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, + TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117' $floorItems['117'] = i - TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, + TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '114' $floorItems['114'] = i - TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, + TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '115' $floorItems['115'] = i - TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, + TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '116' $floorItems['116'] = i - TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, + TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '118' $floorItems['118'] = i - TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, + TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '120' $floorItems['120'] = i - TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, + TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '122' $floorItems['122'] = i - TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, + TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '121' $floorItems['121'] = i - TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, + TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106A' $floorItems['106A'] = i - TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, + TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '105' $floorItems['105'] = i - TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, + TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106B' $floorItems['106B'] = i - TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, + TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '104' $floorItems['104'] = i - TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, + TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '108' $floorItems['108'] = i - TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, + TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '107' $floorItems['107'] = i - TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, + TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Smoking' $floorItems['Smoking'] = i - TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, + TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '123' $floorItems['123'] = i - TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, + TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '103' $floorItems['103'] = i - TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, + TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '124' $floorItems['124'] = i - TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, + TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '125' $floorItems['125'] = i - TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '126' $floorItems['126'] = i - TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '127' $floorItems['127'] = i - TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, + TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'MShower' $floorItems['MShower'] = i - TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, + TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Closet' $floorItems['Closet'] = i - TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, + TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'WShower' $floorItems['WShower'] = i - TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, + TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '130' $floorItems['130'] = i - TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, + TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '102' $floorItems['102'] = i - TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, + TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '128' $floorItems['128'] = i - TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, + TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '129' $floorItems['129'] = i - TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, + TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '133' $floorItems['133'] = i - TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, + TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '132' $floorItems['132'] = i - TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, + TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '134' $floorItems['134'] = i - TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, + TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '135' $floorItems['135'] = i - TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Ramona Stair' $floorItems['Ramona Stair'] = i - TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'University Stair' $floorItems['University Stair'] = i - TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, + TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Stair' $floorItems['Plaza Stair'] = i - TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Deck' $floorItems['Plaza Deck'] = i - TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106' $floorItems['106'] = i - TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, + TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '119' $floorItems['119'] = i - TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, + TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) TkcLine.new(w,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -798,321 +798,321 @@ end def floor_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '238' $floorItems['238'] = i - TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, + TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '237' $floorItems['237'] = i - TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '246' $floorItems['246'] = i - TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, + TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '247' $floorItems['247'] = i - TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, + TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '202' $floorItems['202'] = i - TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, + TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '206' $floorItems['206'] = i - TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, + TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '212' $floorItems['212'] = i - TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, + TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '245' $floorItems['245'] = i - TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, + TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '244' $floorItems['244'] = i - TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, + TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '243' $floorItems['243'] = i - TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, + TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '242' $floorItems['242'] = i - TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, + TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Barbecue Deck' $floorItems['Barbecue Deck'] = i - TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '240' $floorItems['240'] = i - TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, + TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '241' $floorItems['241'] = i - TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, + TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '239' $floorItems['239'] = i - TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, + TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '248' $floorItems['248'] = i - TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, + TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '236' $floorItems['236'] = i - TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, + TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '235' $floorItems['235'] = i - TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, + TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '234' $floorItems['234'] = i - TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, + TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '233' $floorItems['233'] = i - TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, + TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '230' $floorItems['230'] = i - TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, + TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '232' $floorItems['232'] = i - TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, + TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '229' $floorItems['229'] = i - TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, + TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '227' $floorItems['227'] = i - TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '228' $floorItems['228'] = i - TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, + TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '226' $floorItems['226'] = i - TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '225' $floorItems['225'] = i - TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, + TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '224' $floorItems['224'] = i - TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, + TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '223' $floorItems['223'] = i - TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, + TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '222' $floorItems['222'] = i - TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, + TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '221' $floorItems['221'] = i - TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, + TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '204' $floorItems['204'] = i - TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '205' $floorItems['205'] = i - TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, + TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '207' $floorItems['207'] = i - TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, + TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '208' $floorItems['208'] = i - TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, + TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '209' $floorItems['209'] = i - TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, + TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217' $floorItems['217'] = i - TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, + TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217A' $floorItems['217A'] = i - TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, + TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '216' $floorItems['216'] = i - TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, + TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '215' $floorItems['215'] = i - TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, + TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '214' $floorItems['214'] = i - TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, + TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '213' $floorItems['213'] = i - TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, + TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '210' $floorItems['210'] = i - TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, + TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '211' $floorItems['211'] = i - TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, + TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '203' $floorItems['203'] = i - TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, + TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '220' $floorItems['220'] = i - TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, + TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Priv Lift2' $floorItems['Priv Lift2'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Pub Lift 2' $floorItems['Pub Lift 2'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '218' $floorItems['218'] = i - TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '219' $floorItems['219'] = i - TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '201' $floorItems['201'] = i - TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) TkcLine.new(w,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1283,206 +1283,206 @@ def floor_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316' $floorItems['316'] = i - TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, + TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '309' $floorItems['309'] = i - TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, + TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '308' $floorItems['308'] = i - TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, + TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '307' $floorItems['307'] = i - TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, + TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '305' $floorItems['305'] = i - TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, + TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324B' $floorItems['324B'] = i - TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, + TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324A' $floorItems['324A'] = i - TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, + TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '320' $floorItems['320'] = i - TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, + TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '310' $floorItems['310'] = i - TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, + TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '312' $floorItems['312'] = i - TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, + TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '313' $floorItems['313'] = i - TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, + TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '314' $floorItems['314'] = i - TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, + TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '315' $floorItems['315'] = i - TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, + TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316B' $floorItems['316B'] = i - TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, + TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316A' $floorItems['316A'] = i - TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, + TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '319' $floorItems['319'] = i - TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, + TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '311' $floorItems['311'] = i - TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, + TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '318' $floorItems['318'] = i - TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '317' $floorItems['317'] = i - TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '323' $floorItems['323'] = i - TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, + TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '325' $floorItems['325'] = i - TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, + TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '321' $floorItems['321'] = i - TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, + TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '322' $floorItems['322'] = i - TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, + TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Pub Lift3' $floorItems['Pub Lift3'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Priv Lift3' $floorItems['Priv Lift3'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '303' $floorItems['303'] = i - TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, + TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324' $floorItems['324'] = i - TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, + TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '304' $floorItems['304'] = i - TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '301' $floorItems['301'] = i - TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '327' $floorItems['327'] = i - TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, + TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '326' $floorItems['326'] = i - TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, + TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '302' $floorItems['302'] = i - TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, + TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '306' $floorItems['306'] = i - TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, + TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1577,7 +1577,7 @@ end # toplevel widget if defined?($floor_demo) && $floor_demo - $floor_demo.destroy + $floor_demo.destroy $floor_demo = nil end @@ -1593,7 +1593,7 @@ $floor_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){ pack('side'=>'top') } @@ -1616,18 +1616,18 @@ $floor_buttons = TkFrame.new(base_frame) {|frame| } $floor_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# $floorLabels = {} $floorItems = {} -# canvas +# canvas if $tk_version =~ /^4\.[01]/ $floor_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor_canvas = TkCanvas.new($floor_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor_canvas = TkCanvas.new($floor_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1648,20 +1648,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1678,7 +1678,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom = TkVariable.new -$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', +$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom) # Choose colors, then fill in the floorplan. @@ -1715,7 +1715,7 @@ $floor_canvas.itembind('floor3', '1', proc{floorDisplay $floor_canvas,3}) $floor_canvas.itembind('room', 'Enter', proc{newRoom $floor_canvas}) $floor_canvas.itembind('room', 'Leave', proc{$currentRoom.value = ''}) $floor_canvas.bind('2', proc{|x,y| $floor_canvas.scan_mark x,y}, '%x %y') -$floor_canvas.bind('B2-Motion', +$floor_canvas.bind('B2-Motion', proc{|x,y| $floor_canvas.scan_dragto x,y}, '%x %y') $floor_canvas.bind('Destroy', proc{$currentRoom.unset}) $currentRoom.value = '' diff --git a/ext/tk/sample/demos-en/floor2.rb b/ext/tk/sample/demos-en/floor2.rb index 88b07aeee4..3bfa89a920 100644 --- a/ext/tk/sample/demos-en/floor2.rb +++ b/ext/tk/sample/demos-en/floor2.rb @@ -21,7 +21,7 @@ def floorDisplay2(w,active) w.delete('all') $activeFloor2 = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1']) @@ -32,12 +32,12 @@ def floorDisplay2(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -302,7 +302,7 @@ def floor2_bg3(w,fill,outline) w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, + w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -316,316 +316,316 @@ end # color - Color to use for drawing foreground information. def floor2_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '101' $floorItems2['101'] = i - w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Pub Lift1' $floorItems2['Pub Lift1'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Priv Lift1' $floorItems2['Priv Lift1'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '110' $floorItems2['110'] = i - w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, + w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '109' $floorItems2['109'] = i - w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, + w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '111' $floorItems2['111'] = i - w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, + w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117B' $floorItems2['117B'] = i - w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, + w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '112' $floorItems2['112'] = i - w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, + w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '113' $floorItems2['113'] = i - w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, + w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117A' $floorItems2['117A'] = i - w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, + w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117' $floorItems2['117'] = i - w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, + w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '114' $floorItems2['114'] = i - w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, + w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '115' $floorItems2['115'] = i - w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, + w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '116' $floorItems2['116'] = i - w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, + w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '118' $floorItems2['118'] = i - w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, + w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '120' $floorItems2['120'] = i - w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, + w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '122' $floorItems2['122'] = i - w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, + w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '121' $floorItems2['121'] = i - w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, + w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106A' $floorItems2['106A'] = i - w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, + w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '105' $floorItems2['105'] = i - w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, + w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106B' $floorItems2['106B'] = i - w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, + w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '104' $floorItems2['104'] = i - w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, + w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '108' $floorItems2['108'] = i - w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, + w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '107' $floorItems2['107'] = i - w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, + w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Smoking' $floorItems2['Smoking'] = i - w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, + w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '123' $floorItems2['123'] = i - w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, + w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '103' $floorItems2['103'] = i - w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, + w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '124' $floorItems2['124'] = i - w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, + w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '125' $floorItems2['125'] = i - w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '126' $floorItems2['126'] = i - w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '127' $floorItems2['127'] = i - w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, + w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'MShower' $floorItems2['MShower'] = i - w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, + w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Closet' $floorItems2['Closet'] = i - w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, + w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'WShower' $floorItems2['WShower'] = i - w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, + w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '130' $floorItems2['130'] = i - w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, + w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '102' $floorItems2['102'] = i - w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, + w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '128' $floorItems2['128'] = i - w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, + w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '129' $floorItems2['129'] = i - w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, + w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '133' $floorItems2['133'] = i - w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, + w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '132' $floorItems2['132'] = i - w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, + w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '134' $floorItems2['134'] = i - w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, + w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '135' $floorItems2['135'] = i - w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Ramona Stair' $floorItems2['Ramona Stair'] = i - w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'University Stair' $floorItems2['University Stair'] = i - w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, + w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Stair' $floorItems2['Plaza Stair'] = i - w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Deck' $floorItems2['Plaza Deck'] = i - w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106' $floorItems2['106'] = i - w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, + w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '119' $floorItems2['119'] = i - w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, + w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -798,321 +798,321 @@ end def floor2_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '238' $floorItems2['238'] = i - w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, + w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '237' $floorItems2['237'] = i - w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '246' $floorItems2['246'] = i - w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, + w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '247' $floorItems2['247'] = i - w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, + w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '202' $floorItems2['202'] = i - w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, + w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '206' $floorItems2['206'] = i - w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, + w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '212' $floorItems2['212'] = i - w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, + w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '245' $floorItems2['245'] = i - w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, + w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '244' $floorItems2['244'] = i - w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, + w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '243' $floorItems2['243'] = i - w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, + w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '242' $floorItems2['242'] = i - w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, + w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Barbecue Deck' $floorItems2['Barbecue Deck'] = i - w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '240' $floorItems2['240'] = i - w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, + w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '241' $floorItems2['241'] = i - w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, + w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '239' $floorItems2['239'] = i - w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, + w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '248' $floorItems2['248'] = i - w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, + w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '236' $floorItems2['236'] = i - w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, + w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '235' $floorItems2['235'] = i - w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, + w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '234' $floorItems2['234'] = i - w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, + w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '233' $floorItems2['233'] = i - w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, + w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '230' $floorItems2['230'] = i - w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, + w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '232' $floorItems2['232'] = i - w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, + w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '229' $floorItems2['229'] = i - w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, + w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '227' $floorItems2['227'] = i - w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '228' $floorItems2['228'] = i - w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, + w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '226' $floorItems2['226'] = i - w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '225' $floorItems2['225'] = i - w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, + w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '224' $floorItems2['224'] = i - w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, + w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '223' $floorItems2['223'] = i - w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, + w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '222' $floorItems2['222'] = i - w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, + w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '221' $floorItems2['221'] = i - w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, + w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '204' $floorItems2['204'] = i - w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '205' $floorItems2['205'] = i - w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, + w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '207' $floorItems2['207'] = i - w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, + w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '208' $floorItems2['208'] = i - w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, + w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '209' $floorItems2['209'] = i - w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, + w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217' $floorItems2['217'] = i - w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, + w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217A' $floorItems2['217A'] = i - w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, + w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '216' $floorItems2['216'] = i - w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, + w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '215' $floorItems2['215'] = i - w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, + w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '214' $floorItems2['214'] = i - w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, + w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '213' $floorItems2['213'] = i - w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, + w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '210' $floorItems2['210'] = i - w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, + w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '211' $floorItems2['211'] = i - w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, + w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '203' $floorItems2['203'] = i - w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, + w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '220' $floorItems2['220'] = i - w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, + w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Priv Lift2' $floorItems2['Priv Lift2'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Pub Lift 2' $floorItems2['Pub Lift 2'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '218' $floorItems2['218'] = i - w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '219' $floorItems2['219'] = i - w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '201' $floorItems2['201'] = i - w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1283,206 +1283,206 @@ def floor2_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316' $floorItems2['316'] = i - w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, + w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '309' $floorItems2['309'] = i - w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, + w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '308' $floorItems2['308'] = i - w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, + w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '307' $floorItems2['307'] = i - w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, + w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '305' $floorItems2['305'] = i - w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, + w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324B' $floorItems2['324B'] = i - w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, + w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324A' $floorItems2['324A'] = i - w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, + w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '320' $floorItems2['320'] = i - w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, + w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '310' $floorItems2['310'] = i - w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, + w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '312' $floorItems2['312'] = i - w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, + w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '313' $floorItems2['313'] = i - w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, + w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '314' $floorItems2['314'] = i - w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, + w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '315' $floorItems2['315'] = i - w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, + w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316B' $floorItems2['316B'] = i - w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, + w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316A' $floorItems2['316A'] = i - w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, + w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '319' $floorItems2['319'] = i - w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, + w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '311' $floorItems2['311'] = i - w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, + w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '318' $floorItems2['318'] = i - w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '317' $floorItems2['317'] = i - w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '323' $floorItems2['323'] = i - w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, + w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '325' $floorItems2['325'] = i - w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, + w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '321' $floorItems2['321'] = i - w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, + w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '322' $floorItems2['322'] = i - w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, + w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Pub Lift3' $floorItems2['Pub Lift3'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Priv Lift3' $floorItems2['Priv Lift3'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '303' $floorItems2['303'] = i - w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, + w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324' $floorItems2['324'] = i - w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, + w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '304' $floorItems2['304'] = i - w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '301' $floorItems2['301'] = i - w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '327' $floorItems2['327'] = i - w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, + w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '326' $floorItems2['326'] = i - w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, + w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '302' $floorItems2['302'] = i - w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, + w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '306' $floorItems2['306'] = i - w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, + w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1577,7 +1577,7 @@ end # toplevel widget if defined?($floor2_demo) && $floor2_demo - $floor2_demo.destroy + $floor2_demo.destroy $floor2_demo = nil end @@ -1593,7 +1593,7 @@ $floor2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor2_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){ pack('side'=>'top') } @@ -1616,18 +1616,18 @@ $floor2_buttons = TkFrame.new(base_frame) {|frame| } $floor2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# $floorLabels2 = {} $floorItems2 = {} -# canvas +# canvas if $tk_version =~ /^4\.[01]/ $floor2_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor2_canvas = TkCanvas.new($floor2_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new($floor2_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1648,20 +1648,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1678,7 +1678,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom2 = TkVariable.new -$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', +$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom2) # Choose colors, then fill in the floorplan. @@ -1715,7 +1715,7 @@ $floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3}) $floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas}) $floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''}) $floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y') -$floor2_canvas.bind('B2-Motion', +$floor2_canvas.bind('B2-Motion', proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y') $floor2_canvas.bind('Destroy', proc{$currentRoom2.unset}) $currentRoom2.value = '' diff --git a/ext/tk/sample/demos-en/form.rb b/ext/tk/sample/demos-en/form.rb index 3119752b1c..abb3e0e10e 100644 --- a/ext/tk/sample/demos-en/form.rb +++ b/ext/tk/sample/demos-en/form.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($form_demo) && $form_demo - $form_demo.destroy + $form_demo.destroy $form_demo = nil end @@ -43,7 +43,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# entry +# entry form_data = [] (1..5).each{|i| f = TkFrame.new(base_frame, 'bd'=>2) @@ -54,7 +54,7 @@ form_data = [] form_data[i] = {'frame'=>f, 'entry'=>e, 'label'=>l} } -# +# form_data[1]['label'].text('Name:') form_data[2]['label'].text('Address:') form_data[5]['label'].text('Phone:') diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb index c6fa37c09c..d3956ef78c 100644 --- a/ext/tk/sample/demos-en/goldberg.rb +++ b/ext/tk/sample/demos-en/goldberg.rb @@ -43,7 +43,7 @@ #>># lots of canvas create and move calls. if defined?($goldberg_demo) && $goldberg_demo - $goldberg_demo.destroy + $goldberg_demo.destroy $goldberg_demo = nil end @@ -101,7 +101,7 @@ class TkGoldberg_Demo @S['pause'] = TkVariable.new @S['details'] = TkVariable.new(true) - @S['mode'] = TkVariable.new(:MSTART, :symbol) + @S['mode'] = TkVariable.new(:MSTART, :symbol) # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 @@ -132,19 +132,19 @@ class TkGoldberg_Demo @XY = {} @XY6 = { - '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], + '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176], - '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], - '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], - '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], - '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], - '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], - '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], - '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], - '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], - '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], - '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], - '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], + '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], + '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], + '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], + '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], + '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], + '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], + '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], + '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], + '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], + '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], + '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], '13,15'=>[376, 410], '13,16'=>[360, 403] } @@ -161,11 +161,11 @@ class TkGoldberg_Demo def do_display() @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5) - @screen = TkFrame.new(@parent, :bd=>2, - :relief=>:raised).pack(:side=>:left, :fill=>:both, + @screen = TkFrame.new(@parent, :bd=>2, + :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -204,8 +204,8 @@ class TkGoldberg_Demo command proc{showCode 'goldberg'} }.pack('side'=>'left', 'padx'=>5) - # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, - @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) @show.pack('side'=>'left') frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) @@ -214,34 +214,34 @@ class TkGoldberg_Demo end def do_ctrl_frame - @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, + @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, :command=>proc{do_button(0)}) if font = @start['font'] @start.font(font.weight('bold')) end - @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, - :command=>proc{do_button(1)}, :relief=>:raised, + @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, + :command=>proc{do_button(1)}, :relief=>:raised, :variable=>@S['pause']) - @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, + @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, :command=>proc{do_button(2)}) - @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, + @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, :command=>proc{do_button(4)}) - @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, + @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, :command=>proc{do_button(3)}) @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge) - @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, + @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, :relief=>:raised, :variable=>@S['details']) - @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], + @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], :justify=>:center) - @speed_scale = TkScale.new(@parent, :orient=>:horizontal, - :from=>1, :to=>10, :font=>font, - :variable=>@S['speed'], :bd=>2, + @speed_scale = TkScale.new(@parent, :orient=>:horizontal, + :from=>1, :to=>10, :font=>font, + :variable=>@S['speed'], :bd=>2, :relief=>:ridge, :showvalue=>false) - @about = TkButton.new(@parent, :text=>'About', + @about = TkButton.new(@parent, :text=>'About', :command=>proc{about}, :font=>font) Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew) @@ -269,17 +269,17 @@ class TkGoldberg_Demo def do_detail_frame @f_details = TkFrame.new(@details) - @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], + @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], :bd=>1, :relief=>:solid, :bg=>'white') Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0) idx = 1 loop { break unless respond_to?("move#{idx}") - l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, + l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, :width=>2, :bd=>1, :relief=>:solid, :bg=>'white') @STEP[idx] = 0 - ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), + ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), :width=>5, :bd=>1, :relief=>:solid, :bg=>'white') row = (idx + 1)/2 col = ((idx + 1) & 1) * 2 @@ -383,7 +383,7 @@ class TkGoldberg_Demo who = who.to_i n = send("move#{who}") if (n & 1).nonzero? # This guy still alive - alive << who + alive << who end if (n & 2).nonzero? # Next guy is active alive << (who + 1) @@ -416,10 +416,10 @@ class TkGoldberg_Demo # START HERE! banner def draw0 color = @C['0'] - TkcText.new(@canvas, [579, 119], :text=>'START HERE!', - :fill=>color, :anchor=>:w, + TkcText.new(@canvas, [579, 119], :text=>'START HERE!', + :fill=>color, :anchor=>:w, :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold]) - TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, + TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5]) @canvas.itembind('I0', '1'){ start } end @@ -433,7 +433,7 @@ class TkGoldberg_Demo end pos = [ - [673, 119], [678, 119], [683, 119], [688, 119], + [673, 119], [678, 119], [683, 119], [688, 119], [693, 119], [688, 119], [683, 119], [678, 119] ] step = step % pos.length @@ -445,15 +445,15 @@ class TkGoldberg_Demo def draw1 color = @C['1a'] color2 = @C['1b'] - TkcPolygon.new(@canvas, - [ 844, 133, 800, 133, 800, 346, 820, 346, - 820, 168, 844, 168, 844, 133 ], + TkcPolygon.new(@canvas, + [ 844, 133, 800, 133, 800, 346, 820, 346, + 820, 168, 844, 168, 844, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcPolygon.new(@canvas, - [ 771, 133, 685, 133, 685, 168, 751, 168, - 751, 346, 771, 346, 771, 133 ], + TkcPolygon.new(@canvas, + [ 771, 133, 685, 133, 685, 168, 751, 168, + 751, 346, 771, 346, 771, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcOval.new(@canvas, box(812, 122, 9), + TkcOval.new(@canvas, box(812, 122, 9), :tag=>'I1', :fill=>color2, :outline=>'') @canvas.itembind('I1', '1'){ start } @@ -462,9 +462,9 @@ class TkGoldberg_Demo def move1(step = nil) step = get_step(1, step) pos = [ - [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], - [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], - [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], + [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], + [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], + [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], [-100, -100] ] return 0 if step >= pos.length @@ -480,40 +480,40 @@ class TkGoldberg_Demo color = @C['2'] # Fulcrum - TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], + TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], :fill=>@C['fg'], :outline=>@C['fg']) # Strike box - TkcRectangle.new(@canvas, [628, 335, 660, 383], + TkcRectangle.new(@canvas, [628, 335, 660, 383], :fill=>'', :outline=>@C['fg']) (0..2).each{|y| yy = 335 + y*16 - TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) - TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) } # Lever - TkcLine.new(@canvas, [702, 366, 798, 366], + TkcLine.new(@canvas, [702, 366, 798, 366], :fill=>@C['fg'], :width=>6, :tag=>'I2_0') # R strap - TkcLine.new(@canvas, [712, 363, 712, 355], + TkcLine.new(@canvas, [712, 363, 712, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_1') # L strap - TkcLine.new(@canvas, [705, 363, 705, 355], + TkcLine.new(@canvas, [705, 363, 705, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_2') # Match stick - TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], + TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], :fill=>@C['fg'], :width=>3, :tag=>'I2_3') # Match head - TkcPolygon.new(@canvas, - [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, - 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], + TkcPolygon.new(@canvas, + [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, + 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], :fill=>color, :outline=>color, :tag=>'I2_4') end @@ -523,15 +523,15 @@ class TkGoldberg_Demo stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1] xy = [] xy[0] = [ - 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, + 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 662, 318, 662, 328, 671, 336 ] xy[1] = [ - 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, + 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 661, 327, 671, 335 ] xy[2] = [ - 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, + 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 666, 309, 660, 324, 672, 336 ] @@ -542,7 +542,7 @@ class TkGoldberg_Demo if step == 0 # Rotate the match beta = 20 - + ox, oy = anchor('I2_0', :s) # Where to pivot i = 0 @@ -567,23 +567,23 @@ class TkGoldberg_Demo xy = [ [602, 296], [577, 174], [518, 174] ] xy.each{|x, y| # 3 Pulleys - TkcOval.new(@canvas, box(x, y, 13), + TkcOval.new(@canvas, box(x, y, 13), :fill=>color, :outline=>@C['fg'], :width=>3) TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg']) } # Wall to flame - TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', + TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', :width=>3, :fill=>@C['fg'], :smooth=>true) # Flame to pulley 1 - TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', + TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', :width=>3, :fill=>@C['fg'], :smooth=>true) - TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', + TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', :width=>3, :fill=>@C['fg'], :smooth=>true) # Pulley 1 half way to 2 - TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', + TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', :width=>3, :fill=>@C['fg']) # Pulley 1 other half to 2 @@ -593,26 +593,26 @@ class TkGoldberg_Demo TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg']) # Down to weight - TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', + TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', :width=>3, :fill=>@C['fg']) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle x1, y1, x2, y2 = [515, 207, 495, 207] - TkcOval.new(@canvas, box(x1, y1, 6), + TkcOval.new(@canvas, box(x1, y1, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcOval.new(@canvas, box(x2, y2, 6), + TkcOval.new(@canvas, box(x2, y2, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, + TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, :tag=>'I3_', :fill=>color2, :outline=>color2) - - TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), + + TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcLine.new(@canvas, [500, 217, 511, 217], + TkcLine.new(@canvas, [500, 217, 511, 217], :tag=>'I3_', :fill=>color2, :width=>10) # Bottom weight target - TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], + TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10) end @@ -655,7 +655,7 @@ class TkGoldberg_Demo } # Swing gate - TkcLine.new(@canvas, [518, 464, 518, 428], + TkcLine.new(@canvas, [518, 464, 518, 428], :tag=>'I4', :fill=>color, :width=>1) end @@ -682,7 +682,7 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3) xy = [ - 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, + 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452 ] TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color) @@ -692,7 +692,7 @@ class TkGoldberg_Demo xy = box(540, 446, 2) # Eye xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445] - TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], + TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], :outline=>'', :smooth=>true) xy = [538, 454, 535, 461] # Front leg @@ -712,9 +712,9 @@ class TkGoldberg_Demo step = get_step(5, step) pos = [ - [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], - [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], - [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], + [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], + [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], + [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237] ] @@ -735,16 +735,16 @@ class TkGoldberg_Demo color = @C['6'] xy = [324, 130, 391, 204] # Ball holder xy = round_rect(xy, 10) - TkcPolygon.new(@canvas, xy, :smooth=>true, + TkcPolygon.new(@canvas, xy, :smooth=>true, :outline=>@C['fg'], :width=>3, :fill=>color) xy = [339, 204, 376, 253] # Below the ball holder - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>color, :tag=>'I6c') xy = box(346, 339, 28) TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>80, :extent=>205) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>-41, :extent=>85) xy = box(346, 339, 15) # Center of rotor @@ -759,10 +759,10 @@ class TkGoldberg_Demo TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'') xy = [ - 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, + 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 352, 403, 352, 366 ] - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2) # Below rotor TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2) xy = box(275, 342, 7) # On/off rotor @@ -787,7 +787,7 @@ class TkGoldberg_Demo loc = -i color = colors[i] x, y = @XY6["#{loc}"] - TkcOval.new(@canvas, box(x, y, 5), + TkcOval.new(@canvas, box(x, y, 5), :fill=>color, :outline=>color, :tag=>"I6_b#{i}") } draw6a(12) # The wheel @@ -813,7 +813,7 @@ class TkGoldberg_Demo @canvas.move('I6_', -7, 0) if step == 1 # Poke a hole xy = [348, 226, 365, 240] - TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), + TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), :outline=>'') end return 1 @@ -853,24 +853,24 @@ class TkGoldberg_Demo def draw7 color = @C['7'] xy = [198, 306, 277, 374] # Box - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :fill=>color, :tag=>'I7z') @canvas.lower('I7z') xy = [275, 343, 230, 349] - TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, + TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, :arrowshape=>[23, 23, 8], :width=>6) xy = [225, 324] # On button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 323] # On text font = ['Times Roman', 8] - TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, :fill=>@C['fg'], :font=>font) xy = [225, 350] # Off button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 349] # Off text - TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, :fill=>@C['fg'], :font=>font) end @@ -915,7 +915,7 @@ class TkGoldberg_Demo xy = [280, 209, 296, 248] TkcOval.new(@canvas, xy, :outline=>color, :fill=>color) xy = [ - 288, 249, 252, 249, 260, 240, 280, 234, + 288, 249, 252, 249, 260, 240, 280, 234, 296, 234, 316, 240, 324, 249, 288, 249 ] TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true) @@ -924,16 +924,16 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color) xy = [255, 206, 265, 234] # Fan blades - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 176, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 206, 265, 220] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') xy = [255, 190, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') end @@ -958,17 +958,17 @@ class TkGoldberg_Demo color = @C['10a'] color2 = @C['10b'] xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail - TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], :tag=>'I10') xy = box(209, 204, 31) # Front - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = box(249, 204, 31) # Back - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = [200, 171, 200, 249] # Mast @@ -988,10 +988,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(239, 262, 17) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>95, :extent=>103) xy = box(76, 266, 21) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>190) end @@ -999,9 +999,9 @@ class TkGoldberg_Demo step = get_step(10, step) pos = [ - [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], - [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], - [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], + [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], + [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], + [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], [116, 212], [111, 212] ] @@ -1028,21 +1028,21 @@ class TkGoldberg_Demo xy = [55, 504, 55, 591] # Bottom right side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(71, 460, 48) # Outer loop - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>110, :extent=>-290, :tag=>'I11i') xy = box(71, 460, 16) # Inner loop - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', :width=>3, :tag=>'I11i') TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3) xy = [23, 264, 23, 591] # Left side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(1, 266, 23) # Top left curve - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>90) xy = box(75, 235, 9) # The ball - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', :width=>3, :tag=>'I11') end @@ -1050,8 +1050,8 @@ class TkGoldberg_Demo step = get_step(11, step) pos = [ - [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], - [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], + [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], + [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591] ] @@ -1065,11 +1065,11 @@ class TkGoldberg_Demo # Hand def draw12 xy = [ - 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, + 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 60, 590, 60, 610, 60, 610 ] xy.concat([60, 610, 65, 620, 60, 631]) # Thumb - xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, + xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 56, 669, 50, 669, 50, 662, 50, 637]) y0 = 637 # Bumps for fingers @@ -1079,7 +1079,7 @@ class TkGoldberg_Demo x2 = x - 10 xy << x << y0 << x1 << y1 << x2 << y0 } - TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], :smooth=>true, :tag=>'I12', :width=>3) end @@ -1103,25 +1103,25 @@ class TkGoldberg_Demo ] radii = [2, 9, 9, 8, 5, 5, 2] - round_poly(@canvas, xy, radii, :width=>3, + round_poly(@canvas, xy, radii, :width=>3, :outline=>@C['fg'], :fill=>color) - round_poly(@canvas, xy2, radii, :width=>3, + round_poly(@canvas, xy2, radii, :width=>3, :outline=>@C['fg'], :fill=>color) xy = [56, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13') xy = [809, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13R') xy = [112, 687] # Label - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [762, 687] - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [138, 663, 148, 636, 178, 636] # Paper guide @@ -1129,7 +1129,7 @@ class TkGoldberg_Demo xy = [732, 663, 722, 636, 692, 636] TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3) - sine([149, 688, 720, 688], 5, 15, + sine([149, 688, 720, 688], 5, 15, :tag=>'I13_s', :fill=>@C['fg'], :width=>3) end @@ -1159,17 +1159,17 @@ class TkGoldberg_Demo def draw14 color = @C['14'] xy = [102, 661, 113, 632, 130, 618] # Left paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_0') xy = [148, 629, 125, 640, 124, 662] # Right paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_1') draw14a('L') xy = [ 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_0') @canvas.lower('I14R_0') # NB. these numbers are VERY sensitive, you must start with final size @@ -1177,7 +1177,7 @@ class TkGoldberg_Demo xy = [ 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_1') @canvas.lower('I14R_1') end @@ -1190,11 +1190,11 @@ class TkGoldberg_Demo x3, y3, x4, y4, x5, y5 = xy2 zz = [ - x0, y0, x0, y0, xy, x2, y2, x2, y2, + x0, y0, x0, y0, xy, x2, y2, x2, y2, x3, y3, x3, y3, xy2, x5, y5, x5, y5 ].flatten @canvas.delete("I14#{side}") - TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, + TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, :fill=>color, :outline=>color, :width=>3) @canvas.lower("I14#{side}") end @@ -1247,7 +1247,7 @@ class TkGoldberg_Demo xy = [765, 557, 784, 583] TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2) - sine([658, 580, 765, 580], 3, 15, + sine([658, 580, 765, 580], 3, 15, :tag=>'I15_s', :fill=>@C['fg'], :width=>3) end @@ -1286,7 +1286,7 @@ class TkGoldberg_Demo xy = [722, 485, 791, 556] TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3) xy = box(752, 515, 25) # Bell - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', :tag=>'I16b', :width=>2) xy = box(752, 515, 5) # Bell button TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b') @@ -1325,24 +1325,24 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = [664, 523, 717, 549] # Body - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :style=>:chord, :start=>128, :extent=>260, :tag=>'I17') xy = [709, 554, 690, 543] # Paw - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = [657, 544, 676, 555] - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = box(660, 535, 15) # Lower face - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>150, :extent=>240, :tag=>'I17_') - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_') xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, :tag=>['I17_', 'I17_c']) xy = [652, 542, 628, 539] # Whiskers TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') @@ -1352,23 +1352,23 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [668, 543, 687, 538] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 544, 688, 546] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 547, 688, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [649, 530, 654, 538, 659, 530] # Left eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [671, 530, 666, 538, 661, 530] # Right eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [655, 543, 660, 551, 665, 543] # Mouth - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') end @@ -1381,10 +1381,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = box(654, 530, 4) # Left eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') xy = box(666, 530, 4) # Right eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') @canvas.move('I17_', 0, -20) # Move face up @@ -1394,19 +1394,19 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [ # Body - 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, - 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, + 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, + 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 668, 527, 668, 527, 675, 522, 676, 517, 677, 512 ] - TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), - :outline=>@C['fg'], :width=>3, :smooth=>true, + TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), + :outline=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = [716, 514, 716, 554] # Back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [694, 532, 694, 554] # 2nd back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') @canvas.raise('I17w') # Make whiskers visible @@ -1435,14 +1435,14 @@ class TkGoldberg_Demo step = get_step(18, step) pos = [ - [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], + [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], [136, 506], [16, 506], [-100, -100] ] b = [] b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing b[1] = [ - 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, + 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 553, 536, 538, 534, 532, 519, 529, 499 ] b[2] = [ @@ -1473,54 +1473,54 @@ class TkGoldberg_Demo color = @C['19'] xx = [[249, 181], [155, 118], [86, 55], [22, 0]] xx.each{|x1, x2| - TkcRectangle.new(@canvas, x1, 453, x2, 467, + TkcRectangle.new(@canvas, x1, 453, x2, 467, :fill=>color, :outline=>'', :tag=>'I19') - TkcLine.new(@canvas, x1, 453, x2, 453, + TkcLine.new(@canvas, x1, 453, x2, 453, :fill=>@C['fg'], :width=>1) # Pipe top - TkcLine.new(@canvas, x1, 467, x2, 467, + TkcLine.new(@canvas, x1, 467, x2, 467, :fill=>@C['fg'], :width=>1) # Pipe bottom } @canvas.raise('I11i') xy = box(168, 460, 16) # Bulge by the joint TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>21, :extent=>136) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>-21, :extent=>-130) xy = [249, 447, 255, 473] # First joint 26x6 TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1) xy = box(257, 433, 34) # Bend up - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>-91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 433, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>-92) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 421, 34) # Bend left - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(257, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(243, 421, 34) # Bend down - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = box(243, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = [270, 427, 296, 433] # 2nd joint bottom @@ -1562,7 +1562,7 @@ class TkGoldberg_Demo pos = [451, 462, 473, 484, 496, 504, 513, 523, 532] freq = [20, 40, 40, 40, 40, 40, 40, 40, 40] pos = [ - [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], + [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], [504, 40], [513, 40], [523, 40], [532, 40, :x] ] return 0 if step >= pos.length @@ -1579,11 +1579,11 @@ class TkGoldberg_Demo color = @C['20'] @canvas.delete('I20') - sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], + sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], :width=>3, :fill=>color, :smooth=>true) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20a']) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20b']) @canvas.move('I20a', 8, 0) @canvas.move('I20b', 16, 0) @@ -1599,18 +1599,18 @@ class TkGoldberg_Demo xy = [245, 490, 237, 535] # Right side xy2 = [189, 535, 181, 490] # Left side - TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', :tag=>['I21', 'I21f']) TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21') TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21') xy = [182, 486, 244, 498] # Top - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, :tag=>['I21', 'I21f']) - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21t']) xy = [189, 532, 237, 540] # Bottom - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21b']) end @@ -1633,7 +1633,7 @@ class TkGoldberg_Demo @canvas.itemconfigure('I21b', :fill=>@C['20']) @canvas.delete('I21w') - TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, + TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20']) @canvas.lower('I21w', 'I21') @canvas.raise('I21b') @@ -1669,21 +1669,21 @@ class TkGoldberg_Demo color3 = @C['23c'] xy = [185, 623, 253, 650] # Block - TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], + TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], :width=>2, :tag=>'I23a') xy = [187, 592, 241, 623] # Balloon TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', :style=>:arc, :start=>12, :extent=>336) xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b') xy = [285, 611, 250, 603] # Dart body - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail - TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 607, 268, 607] # Dart detail TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d') @@ -1695,7 +1695,7 @@ class TkGoldberg_Demo step = get_step(23, step) pos = [ - [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], + [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100] ] @@ -1715,7 +1715,7 @@ class TkGoldberg_Demo def draw24 color = @C['24a'] xy = [366, 518, 462, 665] # Balloon - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3, :tag=>'I24') xy = [414, 666, 414, 729] # String TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24') @@ -1724,16 +1724,16 @@ class TkGoldberg_Demo :width=>3, :tag=>'I24') xy = [387, 567, 390, 549, 404, 542] # Reflections - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [395, 568, 399, 554, 413, 547] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [403, 570, 396, 555, 381, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [408, 564, 402, 547, 386, 545] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') end @@ -1746,16 +1746,16 @@ class TkGoldberg_Demo if step == 0 @canvas.delete('I24') # Exploding balloon xy = [ - 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, - 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, - 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, - 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, + 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, + 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, + 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, + 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 431, 441, 431, 440, 400, 502, 347, 465, 347, 465 ] - TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], + TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], :outline=>@C['24a'], :width=>10, :smooth=>true) msg = Tk.subst(@S['message'].value) - TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], + TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], :justify=>:center, :font=>['Times Roman', 18, :bold]) return 1 end @@ -1786,8 +1786,8 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', - :text=>'click to continue', + TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', + :text=>'click to continue', :font=>['Times Roman', 24, :bold]) @canvas.bind('1', proc{reset}) return 4 @@ -1967,11 +1967,11 @@ class TkGoldberg_Demo def sparkle(oxy, tag) xy = [ - [299, 283], [298, 302], [295, 314], [271, 331], + [299, 283], [298, 302], [295, 314], [271, 331], [239, 310], [242, 292], [256, 274], [281, 273] ] xy.each{|x, y| - TkcLine.new(@canvas, 271, 304, x, y, + TkcLine.new(@canvas, 271, 304, x, y, :fill=>'white', :width=>3, :tag=>tag) } move_abs(tag, oxy) diff --git a/ext/tk/sample/demos-en/icon.rb b/ext/tk/sample/demos-en/icon.rb index a3921d2333..bab40da214 100644 --- a/ext/tk/sample/demos-en/icon.rb +++ b/ext/tk/sample/demos-en/icon.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($icon_demo) && $icon_demo - $icon_demo.destroy + $icon_demo.destroy $icon_demo = nil end @@ -48,7 +48,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# image +# image flagup = \ TkBitmapImage.new('file'=>[$demo_dir,'..', 'images','flagup.xbm'].join(File::Separator), diff --git a/ext/tk/sample/demos-en/image1.rb b/ext/tk/sample/demos-en/image1.rb index a9072bb308..233cb963d1 100644 --- a/ext/tk/sample/demos-en/image1.rb +++ b/ext/tk/sample/demos-en/image1.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($image1_demo) && $image1_demo - $image1_demo.destroy + $image1_demo.destroy $image1_demo = nil end diff --git a/ext/tk/sample/demos-en/image2.rb b/ext/tk/sample/demos-en/image2.rb index 1975dd6b02..13098af1b6 100644 --- a/ext/tk/sample/demos-en/image2.rb +++ b/ext/tk/sample/demos-en/image2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($image2_demo) && $image2_demo - $image2_demo.destroy + $image2_demo.destroy $image2_demo = nil end @@ -87,13 +87,13 @@ TkFrame.new(base_frame){|w| }.pack('side'=>'top', 'anchor'=>'w') -# image +# image [ TkFrame.new(base_frame, 'height'=>'3m', 'width'=>20), TkLabel.new(base_frame, 'text'=>'Image:'), TkLabel.new(base_frame, 'image'=>$image2a) ].each{|w| w.pack('side'=>'top', 'anchor'=>'w')} -# +# def loadDir(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| diff --git a/ext/tk/sample/demos-en/image3.rb b/ext/tk/sample/demos-en/image3.rb index 43afab7ecd..edb6d231bf 100644 --- a/ext/tk/sample/demos-en/image3.rb +++ b/ext/tk/sample/demos-en/image3.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($image3_demo) && $image3_demo - $image3_demo.destroy + $image3_demo.destroy $image3_demo = nil end @@ -21,7 +21,7 @@ $image3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($image3_demo).pack(:fill=>:both, :expand=>true) -# +# def loadDir3(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| @@ -37,10 +37,10 @@ end # Arguments: # w - Name of the toplevel window of the demo. def selectAndLoadDir3(w, lbox) - dir = Tk.chooseDirectory(:initialdir=>$dirName.value, + dir = Tk.chooseDirectory(:initialdir=>$dirName.value, :parent=>w, :mustexist=>true) if dir.length > 0 - $dirName.value = dir + $dirName.value = dir loadDir3(lbox) end end @@ -92,11 +92,11 @@ image3_f = TkFrame.new(base_frame).pack(:fill=>:both, :expand=>true) image3_df = TkLabelFrame.new(base_frame, :text=>'Directory:') -image3_ff = TkLabelFrame.new(base_frame, :text=>'File:', +image3_ff = TkLabelFrame.new(base_frame, :text=>'File:', :padx=>'2m', :pady=>'2m') image3_lbx = TkListbox.new(image3_ff, :width=>20, :height=>10) { pack(:side=>:left, :fill=>:y, :expand=>true) - yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, + yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, :expand=>true)) insert(0, *(%w(earth.gif earthris.gif teapot.ppm))) bind('Double-1', proc{|x,y| loadImage(self, x, y)}, '%x %y') @@ -107,7 +107,7 @@ image3_ent = TkEntry.new(image3_df, :width=>30, :textvariable=>$dirName){ bind('Return', proc{loadDir3(image3_lbx)}) } -TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"Select Dir.", +TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"Select Dir.", :command=>proc{selectAndLoadDir3(image3_ent, image3_lbx)}) { pack(:side=>:left, :fill=>:y, :padx=>[0, '2m'], :pady=>'2m') } @@ -119,7 +119,7 @@ image3_if = TkLabelFrame.new(base_frame, :text=>'Image:') {|f| Tk.grid(image3_df, '-', :sticky=>:ew, :padx=>'1m', :pady=>'1m', :in=>image3_f) -Tk.grid(image3_ff, image3_if, +Tk.grid(image3_ff, image3_if, :sticky=>:nw, :padx=>'1m', :pady=>'1m', :in=>image3_f) TkGrid.columnconfigure(image3_f, 1, :weight=>1) diff --git a/ext/tk/sample/demos-en/items.rb b/ext/tk/sample/demos-en/items.rb index 3fd44fd4f4..01a4072cb7 100644 --- a/ext/tk/sample/demos-en/items.rb +++ b/ext/tk/sample/demos-en/items.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($items_demo) && $items_demo - $items_demo.destroy + $items_demo.destroy $items_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| # frame cvs = nil TkFrame.new(base_frame) {|cf| - # canvas + # canvas cvs = TkCanvas.new(cf) {|c| focus scrollregion '0c 0c 30c 24c' @@ -75,11 +75,11 @@ TkFrame.new(base_frame) {|cf| c.pack('in'=>cf, 'expand'=>'yes', 'fill'=>'both') else - c.grid('in'=>cf, 'row'=>0, 'column'=>0, + c.grid('in'=>cf, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - vs.grid('row'=>0, 'column'=>1, + vs.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - hs.grid('row'=>1, 'column'=>0, + hs.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) @@ -115,13 +115,13 @@ else green = 'black' end -# tag +# tag $tag_item = TkcGroup.new(cvs) # Set up demos within each of the areas of the grid. TkcText.new(cvs, '5c', '.2c', 'text'=>'Lines', 'anchor'=>'n') -TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', - 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', +TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', + 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', 'join'=>'miter', 'tags'=>$tag_item ) TkcLine.new(cvs, '4.67c','1c','4.67c','4c', 'arrow'=>'last', 'tags'=>$tag_item) TkcLine.new(cvs, '6.33c','1c','6.33c','4c', 'arrow'=>'both', 'tags'=>$tag_item) @@ -129,38 +129,38 @@ TkcLine.new(cvs, '5c','6c','9c','6c','9c','1c','8c','1c','8c','4.8c','8.8c', '4.8c','8.8c','1.2c','8.2c','1.2c','8.2c','4.6c','8.6c','4.6c', '8.6c','1.4c','8.4c','1.4c','8.4c','4.4c', 'width'=>3, 'fill'=>red, 'tags'=>$tag_item ) -TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', +TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', 'stipple'=>'@'+[$demo_dir,'..', - 'images','gray25.xbm'].join(File::Separator), + 'images','gray25.xbm'].join(File::Separator), 'arrow'=>'both', 'arrowshape'=>'15 15 7', 'tags'=>$tag_item ) TkcLine.new(cvs, '1c','7c','1.75c','5.8c','2.5c','7c','3.25c','5.8c','4c','7c', - 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', + 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', 'tags'=>$tag_item ) -TkcText.new(cvs, '15c', '.2c', +TkcText.new(cvs, '15c', '.2c', 'text'=>'Curves (smoothed lines)', 'anchor'=>'n') -TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', +TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', 'smooth'=>'on', 'fill'=>blue, 'tags'=>$tag_item ) -TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', +TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', 'smooth'=>'on', 'arrow'=>'both', 'width'=>3, 'tags'=>$tag_item ) -TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', +TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', '16.5c','4.5c','13.5c','7.5c','12c','6c', - 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', + 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', 'stipple'=>'@'+[$demo_dir, '..', - 'images', 'gray25.xbm'].join(File::Separator), + 'images', 'gray25.xbm'].join(File::Separator), 'fill'=>red, 'tags'=>$tag_item ) TkcText.new(cvs, '25c', '.2c', 'text'=>'Polygons', 'anchor'=>'n') TkcPolygon.new(cvs, '21c','1.0c','22.5c','1.75c','24c','1.0c','23.25c','2.5c', '24c','4.0c','22.5c','3.25c','21c','4.0c','21.75c','2.5c', - 'fill'=>'green', 'outline'=>'black', 'width'=>4, + 'fill'=>'green', 'outline'=>'black', 'width'=>4, 'tags'=>$tag_item ) TkcPolygon.new(cvs, '25c','4c','25c','4c','25c','1c','26c','1c','27c','4c', '28c','1c','29c','1c','29c','4c','29c','4c', 'fill'=>red, 'smooth'=>'on', 'tags'=> $tag_item) TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', '28c','5.25c','24c','5.25c','24c','6.0c','26c','6c','26c', - '7.5c','22c','7.5c', + '7.5c','22c','7.5c', 'stipple'=>'@' + [$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator), 'outline'=>'black', 'tags'=>$tag_item ) @@ -168,7 +168,7 @@ TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', TkcText.new(cvs, '5c', '8.2c', 'text'=>'Rectangles', 'anchor'=>'n') TkcRectangle.new(cvs, '1c','9.5c','4c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', +TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -178,7 +178,7 @@ TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', TkcText.new(cvs, '15c', '8.2c', 'text'=>'Ovals', 'anchor'=>'n') TkcOval.new(cvs, '11c','9.5c','14c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', +TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -187,40 +187,40 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', TkcText.new(cvs, '25c', '8.2c', 'text'=>'Text', 'anchor'=>'n') TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c') -TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', +TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', 'text'=>'A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text.', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') -TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, +TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, 'text'=>"Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge.", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, 'stipple'=>'@' + [$demo_dir, '..', 'images', 'grey.5'].join(File::Separator), 'text'=>'Stippled characters', 'tags'=>$tag_item ) else - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, - 'stipple'=>'gray50', 'text'=>'Stippled characters', + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + 'stipple'=>'gray50', 'text'=>'Stippled characters', 'tags'=>$tag_item ) end TkcText.new(cvs, '5c', '16.2c', 'text'=>'Arcs', 'anchor'=>'n') -TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', +TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', 'start'=>45, 'extent'=>270, 'style'=>'pieslice', 'tags'=>$tag_item) -#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', -# 'outline'=>blue, 'start'=>135, 'extent'=>270, +#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', +# 'outline'=>blue, 'start'=>135, 'extent'=>270, # 'outlinestipple'=>'@' + ['images', 'grey.25'].join(File::Separator), # 'tags'=>$tag_item) -TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', - 'outline'=>blue, 'start'=>135, 'extent'=>270, +TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', + 'outline'=>blue, 'start'=>135, 'extent'=>270, 'outlinestipple'=>'@'+[$demo_dir, '..', 'images','gray25.xbm'].join(File::Separator), 'tags'=>$tag_item) -TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', - 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, +TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', + 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, 'tags'=>$tag_item) TkcArc.new(cvs, '5.5c','20.5c','9.5c','23.5c', 'width'=>'4m', 'style'=>'chord', - 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, + 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, 'tags'=>$tag_item) TkcText.new(cvs, '15c', '16.2c', 'text'=>'Bitmaps', 'anchor'=>'n') @@ -241,7 +241,7 @@ TkcBitmap.new(cvs, '17c','18.5c', #TkcBitmap.new(cvs, '17c','21.5c', # 'bitmap'=>'@' + ['images', 'letters'].join(File::Separator), # 'tags'=>$tag_item) -# +# TkcBitmap.new(cvs, '17c','21.5c') { bitmap '@' + [$demo_dir, '..', 'images', 'letters.xbm'].join(File::Separator) tags $tag_item @@ -255,17 +255,17 @@ TkcText.new(cvs, '25c', '16.2c', 'text'=>'Windows', 'anchor'=>'n') TkButton.new(cvs) {|b| text 'Press Me' command proc{butPress cvs, red} - TkcWindow.new(cvs, '21c','18c', + TkcWindow.new(cvs, '21c','18c', 'window'=>b, 'anchor'=>'nw', 'tags'=>$tag_item) } TkEntry.new(cvs, 'width'=>20, 'relief'=>'sunken') {|e| insert 'end', 'Edit this text' - TkcWindow.new(cvs, '21c','21c', + TkcWindow.new(cvs, '21c','21c', 'window'=>e, 'anchor'=>'nw', 'tags'=>$tag_item) } -TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', +TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', 'width'=>'.5c', 'tickinterval'=>0 ) {|scl| - TkcWindow.new(cvs, '28.5c','17.5c', + TkcWindow.new(cvs, '28.5c','17.5c', 'window'=>scl, 'anchor'=>'n', 'tags'=>$tag_item) } TkcText.new(cvs, '21c', '17.9c', 'text'=>'Button:', 'anchor'=>'sw') @@ -316,7 +316,7 @@ def itemLeave(c) $restoreCmd.call if $restoreCmd end -# Utility methods for stroking out a rectangle and printing what's +# Utility methods for stroking out a rectangle and printing what's # underneath the rectangle's area. def itemMark(c,x,y) @@ -330,7 +330,7 @@ def itemStroke(c,x,y) y = c.canvasy(y) if $areaX1 != x && $areaY1 != y c.delete 'area' - c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, + c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, '-outline', 'black') $areaX2 = x $areaY2 = y @@ -371,11 +371,11 @@ def itemDrag(c,x,y) $lastY = y end -# Method that's invoked when the button embedded in the canvas +# Method that's invoked when the button embedded in the canvas # is invoked. def butPress(w,color) - i = TkcText.new(w, '25c', '18.1c', + i = TkcText.new(w, '25c', '18.1c', 'text'=>'Ouch!!', 'fill'=>color, 'anchor'=>'n') Tk.after(500, proc{w.delete i}) end diff --git a/ext/tk/sample/demos-en/knightstour.rb b/ext/tk/sample/demos-en/knightstour.rb index 618fce5f02..6f96a5be10 100644 --- a/ext/tk/sample/demos-en/knightstour.rb +++ b/ext/tk/sample/demos-en/knightstour.rb @@ -155,16 +155,16 @@ class Knights_Tour frame = Ttk::Frame.new($knightstour) sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'knightstour'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'knightstour'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $knightstour.destroy $knightstour = nil - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) frame @@ -176,7 +176,7 @@ class Knights_Tour $knightstour.withdraw base_f = Ttk::Frame.new($knightstour) @board = Tk::Canvas.new(base_f, :width=>240, :height=>240) - @log = Tk::Text.new(base_f, :width=>12, :height=>1, + @log = Tk::Text.new(base_f, :width=>12, :height=>1, :font=>'Arial 8', :background=>'white') scr = @log.yscrollbar(Ttk::Scrollbar.new(base_f)) @@ -186,13 +186,13 @@ class Knights_Tour tool_f = Ttk::Frame.new($knightstour) label = Ttk::Label.new(tool_f, :text=>'Speed') - scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, + scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, :command=>proc{|n| set_delay(n)}) - check = Ttk::Checkbutton.new(tool_f, :text=>'Repeat', + check = Ttk::Checkbutton.new(tool_f, :text=>'Repeat', :variable=>@continuous) - @start_btn = Ttk::Button.new(tool_f, :text=>'Start', + @start_btn = Ttk::Button.new(tool_f, :text=>'Start', :command=>proc{tour()}) - @exit_btn = Ttk::Button.new(tool_f, :text=>'Exit', + @exit_btn = Ttk::Button.new(tool_f, :text=>'Exit', :command=>proc{_exit()}) 7.downto(0){|row| @@ -205,16 +205,16 @@ class Knights_Tour dfill = 'tan4' end coords = [col * 30 + 4, row * 30 + 4, col * 30 + 30, row * 30 + 30] - @board.create(TkcRectangle, coords, + @board.create(TkcRectangle, coords, :fill=>fill, :disabledfill=>dfill, :width=>2, :state=>:disabled) } } @knight_font = TkFont.new(:size=>-24) - @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, - :text=>Tk::UTF8_String.new('\u265e'), - :anchor=>'nw', # :tags=>'knight', + @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, + :text=>Tk::UTF8_String.new('\u265e'), + :anchor=>'nw', # :tags=>'knight', :fill=>'black', :activefill=>'#600000') @knight.coords(@board.coords(rand(64)+1)[0..1]) @knight.bind('ButtonPress-1', '%W %x %y'){|w,x,y| drag_start(w,x,y)} diff --git a/ext/tk/sample/demos-en/label.rb b/ext/tk/sample/demos-en/label.rb index 91e41e4a22..5be06eafee 100644 --- a/ext/tk/sample/demos-en/label.rb +++ b/ext/tk/sample/demos-en/label.rb @@ -8,11 +8,11 @@ # toplevel widget if defined?($label_demo) && $label_demo - $label_demo.destroy + $label_demo.destroy $label_demo = nil end -# demo toplevel widget +# demo toplevel widget $label_demo = TkToplevel.new {|w| title("Label Demonstration") iconname("label") @@ -21,7 +21,7 @@ $label_demo = TkToplevel.new {|w| base_frame = TkFrame.new($label_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,7 +30,7 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -48,15 +48,15 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# label demo +# label demo f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) -[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', +[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=>10, 'fill'=>'both')} -# label +# label [ TkLabel.new(f_left, 'text'=>'First label'), - TkLabel.new(f_left, 'text'=>'Second label, raised', + TkLabel.new(f_left, 'text'=>'Second label, raised', 'relief'=>'raised'), TkLabel.new(f_left, 'text'=>'Third label, sunken', 'relief'=>'sunken') ].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')} diff --git a/ext/tk/sample/demos-en/labelframe.rb b/ext/tk/sample/demos-en/labelframe.rb index c912ff4c52..ad968bc061 100644 --- a/ext/tk/sample/demos-en/labelframe.rb +++ b/ext/tk/sample/demos-en/labelframe.rb @@ -7,7 +7,7 @@ if defined?($labelframe_demo) && $labelframe_demo - $labelframe_demo.destroy + $labelframe_demo.destroy $labelframe_demo = nil end @@ -20,8 +20,8 @@ $labelframe_demo = TkToplevel.new {|w| base_frame = TkFrame.new($labelframe_demo).pack(:fill=>:both, :expand=>true) # Some information -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) Labelframes are used to group related widgets together. \ The label may be either plain text or another widget. \ @@ -45,17 +45,17 @@ TkFrame.new(base_frame){|f| } # Demo area -w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, +w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, :expand=>true) # A group of radiobuttons in a labelframe -TkLabelFrame.new(w, :text=>'Value', +TkLabelFrame.new(w, :text=>'Value', :padx=>2, :pady=>2) {|f| grid(:row=>0, :column=>0, :pady=>'2m', :padx=>'2m') v = TkVariable.new (1..4).each{|i| - TkRadiobutton.new(f, :text=>"This is value #{i}", + TkRadiobutton.new(f, :text=>"This is value #{i}", :variable=>v, :value=>i) { pack(:side=>:top, :fill=>:x, :pady=>2) } @@ -78,7 +78,7 @@ def lfEnableButtons(w) end TkLabelFrame.new(w, :pady=>2, :padx=>2){|f| - TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, + TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, :text=>"Use this option.", :padx=>0) {|cb| command proc{lfEnableButtons(f)} f.labelwidget(cb) diff --git a/ext/tk/sample/demos-en/mclist.rb b/ext/tk/sample/demos-en/mclist.rb index a849eba515..17019bb15b 100644 --- a/ext/tk/sample/demos-en/mclist.rb +++ b/ext/tk/sample/demos-en/mclist.rb @@ -6,7 +6,7 @@ # based on "Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($mclist_demo) && $mclist_demo - $mclist_demo.destroy + $mclist_demo.destroy $mclist_demo = nil end @@ -19,8 +19,8 @@ $mclist_demo = TkToplevel.new {|w| base_frame = TkFrame.new($mclist_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ @@ -36,23 +36,23 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'mclist'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'mclist'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $mclist_demo.destroy $mclist_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) } container = Ttk::Frame.new(base_frame) -tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), :show=>:headings) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) @@ -70,20 +70,20 @@ container.grid_rowconfigure(0, :weight=>1) ## The data we're going to insert data = [ - ['Argentina', 'Buenos Aires', 'ARS'], - ['Australia', 'Canberra', 'AUD'], - ['Brazil', 'Brazilia', 'BRL'], - ['Canada', 'Ottawa', 'CAD'], - ['China', 'Beijing', 'CNY'], - ['France', 'Paris', 'EUR'], - ['Germany', 'Berlin', 'EUR'], - ['India', 'New Delhi', 'INR'], - ['Italy', 'Rome', 'EUR'], - ['Japan', 'Tokyo', 'JPY'], - ['Mexico', 'Mexico City', 'MXN'], - ['Russia', 'Moscow', 'RUB'], - ['South Africa', 'Pretoria', 'ZAR'], - ['United Kingdom', 'London', 'GBP'], + ['Argentina', 'Buenos Aires', 'ARS'], + ['Australia', 'Canberra', 'AUD'], + ['Brazil', 'Brazilia', 'BRL'], + ['Canada', 'Ottawa', 'CAD'], + ['China', 'Beijing', 'CNY'], + ['France', 'Paris', 'EUR'], + ['Germany', 'Berlin', 'EUR'], + ['India', 'New Delhi', 'INR'], + ['Italy', 'Rome', 'EUR'], + ['Japan', 'Tokyo', 'JPY'], + ['Mexico', 'Mexico City', 'MXN'], + ['Russia', 'Moscow', 'RUB'], + ['South Africa', 'Pretoria', 'ZAR'], + ['United Kingdom', 'London', 'GBP'], ['United States', 'Washington, D.C.', 'USD'], ] @@ -91,7 +91,7 @@ data = [ font = Ttk::Style.lookup(tree[:style], :font) cols = %w(country capital currency) cols.zip(%w(Country Capital Currency)).each{|col, name| - tree.heading_configure(col, :text=>name, + tree.heading_configure(col, :text=>name, :command=>proc{sort_by(tree, col, false)}) tree.column_configure(col, :width=>TkFont.measure(font, name)) } @@ -109,8 +109,8 @@ data.each{|country, capital, currency| ## Code to do the sorting of the tree contents when clicked on def sort_by(tree, col, direction) - tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . - sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . + tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . + sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . each_with_index{|info, idx| tree.move(info[1], nil, idx)} tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)}) diff --git a/ext/tk/sample/demos-en/menu.rb b/ext/tk/sample/demos-en/menu.rb index bf6c22cb9d..a458dbbc14 100644 --- a/ext/tk/sample/demos-en/menu.rb +++ b/ext/tk/sample/demos-en/menu.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($menu_demo) && $menu_demo - $menu_demo.destroy + $menu_demo.destroy $menu_demo = nil end @@ -54,7 +54,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# menu +# menu TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|file_menu| @@ -86,8 +86,8 @@ TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m| m.configure('menu'=>basic_menu) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -98,17 +98,17 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.configure('menu'=>cascade_menu) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons', + cascade_menu.add('cascade', 'label'=>'Check buttons', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'Oil checked', 'variable'=>oil) @@ -119,18 +119,18 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| lights = TkVariable.new(0) add('check', 'label'=>'Lights checked', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu_demo, - ['oil', oil], - ['trans', trans], - ['brakes', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu_demo, + ['oil', oil], + ['trans', trans], + ['brakes', brakes], ['lights', lights])} ) invoke 1 invoke 3 } TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons', + cascade_menu.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -144,9 +144,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu_demo, - ['pointSize', pointSize], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -158,15 +158,15 @@ TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.configure('menu'=>icon_menu) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'Dismiss')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, + add('command', 'bitmap'=>icon, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } } @@ -178,7 +178,7 @@ TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m| m.configure('menu'=>more_menu) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -189,7 +189,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Colors', 'underline'=>0) {|m| TkMenu.new(m) {|colors_menu| m.configure('menu'=>colors_menu) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-en/menu84.rb b/ext/tk/sample/demos-en/menu84.rb index 4029ce5541..4fc53962e7 100644 --- a/ext/tk/sample/demos-en/menu84.rb +++ b/ext/tk/sample/demos-en/menu84.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($menu84_demo) && $menu84_demo - $menu84_demo.destroy + $menu84_demo.destroy $menu84_demo = nil end @@ -36,9 +36,9 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { menustatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', - 'bd'=>1, 'font'=>['Helvetica', '10'], - 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, + TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', + 'bd'=>1, 'font'=>['Helvetica', '10'], + 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, 'expand'=>true, 'fill'=>'both') pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) } @@ -92,8 +92,8 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Basic', 'menu'=>m, 'underline'=>0) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu84_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -101,17 +101,17 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Cascades', 'menu'=>m, 'underline'=>0) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu84_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu84_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - m.add('cascade', 'label'=>'Check buttons', + m.add('cascade', 'label'=>'Check buttons', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'Oil checked', 'variable'=>oil) @@ -122,18 +122,18 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'Lights checked', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['oil', oil], - ['trans', trans], - ['brakes', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['oil', oil], + ['trans', trans], + ['brakes', brakes], ['lights', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - m.add('cascade', 'label'=>'Radio buttons', + m.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -147,9 +147,9 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['pointSize', pointSize], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -158,15 +158,15 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Icons', 'menu'=>m, 'underline'=>0) - add('command', 'hidemargin'=>1, + add('command', 'hidemargin'=>1, 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'Dismiss')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -177,19 +177,19 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'More', 'menu'=>m, 'underline'=>0) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } - m.entryconfigure('Does almost nothing', - 'bitmap'=>'questhead', 'compound'=>'left', + m.entryconfigure('Does almost nothing', + 'bitmap'=>'questhead', 'compound'=>'left', 'command'=>proc{ - TkDialog.new('title'=>'Compound Menu Entry', + TkDialog.new('title'=>'Compound Menu Entry', 'message'=>'The menu entry you invoked'+ 'displays both a bitmap and '+ 'a text string. Other than '+ 'this, it isjust like any '+ - 'other menu entry.', + 'other menu entry.', 'buttons'=>['OK'], 'bitmap'=>'') }) } @@ -197,7 +197,7 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame) {|m| $menu84_frame.add('cascade', 'label'=>'Colors', 'menu'=>m, 'underline'=>0) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-en/menubu.rb b/ext/tk/sample/demos-en/menubu.rb index b37367e515..6e28e813b3 100644 --- a/ext/tk/sample/demos-en/menubu.rb +++ b/ext/tk/sample/demos-en/menubu.rb @@ -21,7 +21,7 @@ def optionMenu(menubutton, varName, firstValue, *rest) for i in rest menu.add 'radio', 'label'=>i, 'variable'=>varName end - + return menu end @@ -188,7 +188,7 @@ msg.pack('side'=>'top', 'padx'=>25, 'pady'=>25) TkFrame.new(center) {|f| menubuttonoptions = TkVariable.new mbutton = TkMenubutton.new(f) - options = optionMenu(mbutton, menubuttonoptions, + options = optionMenu(mbutton, menubuttonoptions, 'one', 'two', 'three') mbutton.pack('side'=>'left', 'padx'=>25, 'pady'=>25) paletteColor = TkVariable.new diff --git a/ext/tk/sample/demos-en/msgbox.rb b/ext/tk/sample/demos-en/msgbox.rb index 62b1f2b985..d3d66bfeb0 100644 --- a/ext/tk/sample/demos-en/msgbox.rb +++ b/ext/tk/sample/demos-en/msgbox.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($msgbox_demo) && $msgbox_demo - $msgbox_demo.destroy + $msgbox_demo.destroy $msgbox_demo = nil end @@ -49,9 +49,9 @@ TkFrame.new(base_frame) {|frame| # frame $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'Icon').pack('side'=>'top') @@ -60,9 +60,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -71,20 +71,20 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{button}\"") end diff --git a/ext/tk/sample/demos-en/msgbox2.rb b/ext/tk/sample/demos-en/msgbox2.rb index 136a723c73..c227b59bb1 100644 --- a/ext/tk/sample/demos-en/msgbox2.rb +++ b/ext/tk/sample/demos-en/msgbox2.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($msgbox2_demo) && $msgbox2_demo - $msgbox2_demo.destroy + $msgbox2_demo.destroy $msgbox2_demo = nil end @@ -49,9 +49,9 @@ TkFrame.new(base_frame) {|frame| # frame $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'Icon').pack('side'=>'top') @@ -60,9 +60,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -71,21 +71,21 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox2(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"\"#{$msgboxType.value}\" Type MessageBox", 'detail'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon. Please click one of the following button.") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{button}\"") end diff --git a/ext/tk/sample/demos-en/paned1.rb b/ext/tk/sample/demos-en/paned1.rb index 26941b84a8..d3d66d1b16 100644 --- a/ext/tk/sample/demos-en/paned1.rb +++ b/ext/tk/sample/demos-en/paned1.rb @@ -6,7 +6,7 @@ # based on "Id: paned1.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned1_demo) && $paned1_demo - $paned1_demo.destroy + $paned1_demo.destroy $paned1_demo = nil end @@ -18,8 +18,8 @@ $paned1_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned1_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) The sash between the two coloured windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.) If your Tk library linked to Ruby doesn't include a 'panedwindow', this demo doesn't work. Please use later version of Tk which supports a 'panedwindow'. @@ -40,7 +40,7 @@ TkFrame.new(base_frame){|f| } TkPanedwindow.new(base_frame, :orient=>:horizontal){|f| - add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), + add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), Tk::Label.new(f, :text=>"This is the\nright side", :bg=>'cyan')) pack(:side=>:top, :expand=>true, :fill=>:both, :pady=>2, :padx=>'2m') diff --git a/ext/tk/sample/demos-en/paned2.rb b/ext/tk/sample/demos-en/paned2.rb index 0e62013886..02293b0309 100644 --- a/ext/tk/sample/demos-en/paned2.rb +++ b/ext/tk/sample/demos-en/paned2.rb @@ -6,7 +6,7 @@ # based on "Id: paned2.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned2_demo) && $paned2_demo - $paned2_demo.destroy + $paned2_demo.destroy $paned2_demo = nil end @@ -18,8 +18,8 @@ $paned2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned2_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.) If your Tk library linked to Ruby doesn't include a 'panedwindow', this demo doesn't work. Please use later version of Tk which supports a 'panedwindow'. @@ -42,23 +42,23 @@ TkFrame.new(base_frame){|f| paneList = TkVariable.new # define as normal variable (not array) paneList.value = [ # ruby's array --> tcl's list 'List of Ruby/Tk Widgets', - 'TkButton', - 'TkCanvas', - 'TkCheckbutton', - 'TkEntry', - 'TkFrame', - 'TkLabel', - 'TkLabelframe', - 'TkListbox', - 'TkMenu', - 'TkMenubutton', - 'TkMessage', - 'TkPanedwindow', - 'TkRadiobutton', - 'TkScale', - 'TkScrollbar', - 'TkSpinbox', - 'TkText', + 'TkButton', + 'TkCanvas', + 'TkCheckbutton', + 'TkEntry', + 'TkFrame', + 'TkLabel', + 'TkLabelframe', + 'TkListbox', + 'TkMenu', + 'TkMenubutton', + 'TkMessage', + 'TkPanedwindow', + 'TkRadiobutton', + 'TkScale', + 'TkScrollbar', + 'TkSpinbox', + 'TkText', 'TkToplevel' ] @@ -69,13 +69,13 @@ TkPanedwindow.new(base_frame, :orient=>:vertical){|f| add(TkFrame.new(f){|paned2_top| TkListbox.new(paned2_top, :listvariable=>paneList) { # Invert the first item to highlight it - itemconfigure(0, :background=>self.cget(:foreground), + itemconfigure(0, :background=>self.cget(:foreground), :foreground=>self.cget(:background) ) - yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, + yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, :fill=>:y)) pack(:fill=>:both, :expand=>true) } - }, + }, TkFrame.new(f, :height=>120) {|paned2_bottom| # The bottom window is a text widget with scrollbar diff --git a/ext/tk/sample/demos-en/pendulum.rb b/ext/tk/sample/demos-en/pendulum.rb index 5f7d361170..306ac94a21 100644 --- a/ext/tk/sample/demos-en/pendulum.rb +++ b/ext/tk/sample/demos-en/pendulum.rb @@ -7,7 +7,7 @@ # destroy toplevel widget for this demo script if defined?($pendulum_demo) && $pendulum_demo - $pendulum_demo.destroy + $pendulum_demo.destroy $pendulum_demo = nil end @@ -59,14 +59,14 @@ class PendulumAnimationDemo # Create the canvas containing the graphical representation of the # simulated system. - @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', + @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) - TkcText.new(@c, 5, 5, :anchor=>:nw, + TkcText.new(@c, 5, 5, :anchor=>:nw, :text=>'Click to Adjust Bob Start Position') # Coordinates of these items don't matter; they will be set properly below @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50') @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black') - @bob = TkcOval.new(@c, 1, 1, 2, 2, + @bob = TkcOval.new(@c, 1, 1, 2, 2, :width=>3, :fill=>'yellow', :outline=>'black') TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'') @@ -76,22 +76,22 @@ class PendulumAnimationDemo # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. - @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', + @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last) @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last) @graph = {} 90.step(0, -10){|i| - # Coordinates of these items don't matter; + # Coordinates of these items don't matter; # they will be set properly below @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}") } # labels - @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'q', :font=>'Symbol 8') - @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'dq', :font=>'Symbol 8') # pack @@ -109,19 +109,19 @@ class PendulumAnimationDemo # binding @c.bindtags_unshift(btag = TkBindTag.new) btag.bind('Destroy'){ @timer.stop } - btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, + btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, '%x %y') btag.bind('B1-Motion', proc{|x, y| showPendulum(x.to_i, y.to_i)}, '%x %y') - btag.bind('ButtonRelease-1', - proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, + btag.bind('ButtonRelease-1', + proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, '%x %y') btag.bind('Configure', proc{|w| @plate.coords(0, 25, w.to_i, 25)}, '%w') - @k.bind('Configure', proc{|h, w| + @k.bind('Configure', proc{|h, w| h = h.to_i w = w.to_i - @psh = h/2; + @psh = h/2; @psw = w/2 @x_axis.coords(2, @psh, w-2, @psh) @y_axis.coords(@psw, h-2, @psw, 2) @@ -142,9 +142,9 @@ class PendulumAnimationDemo end # This procedure makes the pendulum appear at the correct place on the - # canvas. If the additional arguments x, y are passed instead of computing - # the position of the pendulum from the length of the pendulum rod and its - # angle, the length and angle are computed in reverse from the given + # canvas. If the additional arguments x, y are passed instead of computing + # the position of the pendulum from the length of the pendulum rod and its + # angle, the length and angle are computed in reverse from the given # location (which is taken to be the centre of the pendulum bob.) def showPendulum(x=nil, y=nil) if x && y && (x != 160 || y != 25) diff --git a/ext/tk/sample/demos-en/plot.rb b/ext/tk/sample/demos-en/plot.rb index 628c9df584..f70daa3fb2 100644 --- a/ext/tk/sample/demos-en/plot.rb +++ b/ext/tk/sample/demos-en/plot.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($plot_demo) && $plot_demo - $plot_demo.destroy + $plot_demo.destroy $plot_demo = nil end @@ -22,7 +22,7 @@ $plot_demo = TkToplevel.new {|w| base_frame = TkFrame.new($plot_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."){ pack('side'=>'top') } @@ -45,55 +45,55 @@ $plot_buttons = TkFrame.new(base_frame) {|frame| } $plot_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# font +# font plotFont = '-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*' -# canvas +# canvas $plot_canvas = TkCanvas.new(base_frame,'relief'=>'raised','width'=>450,'height'=>300) $plot_canvas.pack('side'=>'top', 'fill'=>'x') -# plot +# plot TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2) TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2) -TkcText.new($plot_canvas, 225, 20, +TkcText.new($plot_canvas, 225, 20, 'text'=>"A Simple Plot", 'font'=>plotFont, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($plot_canvas, x, 250, x, 245, 'width'=>2) - TkcText.new($plot_canvas, x, 254, + TkcText.new($plot_canvas, x, 254, 'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($plot_canvas, 100, y, 105, y, 'width'=>2) - TkcText.new($plot_canvas, 96, y, + TkcText.new($plot_canvas, 96, y, 'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, + item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end -$plot_canvas.itembind('point', 'Any-Enter', +$plot_canvas.itembind('point', 'Any-Enter', proc{$plot_canvas.itemconfigure 'current','fill','red'}) -$plot_canvas.itembind('point', 'Any-Leave', +$plot_canvas.itembind('point', 'Any-Leave', proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) -$plot_canvas.itembind('point', '1', +$plot_canvas.itembind('point', '1', proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") -$plot_canvas.itembind('point', 'ButtonRelease-1', +$plot_canvas.itembind('point', 'ButtonRelease-1', proc{$plot_canvas.dtag 'selected'}) -$plot_canvas.bind('B1-Motion', +$plot_canvas.bind('B1-Motion', proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") $plot = {'lastX'=>0, 'lastY'=>0} # plotDown -- -# This method is invoked when the mouse is pressed over one of the +# This method is invoked when the mouse is pressed over one of the # data points. It sets up state to allow the point to be dragged. # # Arguments: diff --git a/ext/tk/sample/demos-en/puzzle.rb b/ext/tk/sample/demos-en/puzzle.rb index 43c61f519f..f16414aa4c 100644 --- a/ext/tk/sample/demos-en/puzzle.rb +++ b/ext/tk/sample/demos-en/puzzle.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($puzzle_demo) && $puzzle_demo - $puzzle_demo.destroy + $puzzle_demo.destroy $puzzle_demo = nil end @@ -70,7 +70,7 @@ end # depend_on_button_width = true depend_on_button_width = false - + s = TkScrollbar.new(base_frame) base = TkFrame.new(base_frame) { width frameWidth @@ -101,7 +101,7 @@ order = [3,1,6,2,5,7,15,13,4,11,8,9,14,10,12] if depend_on_button_width && (w.winfo_reqwidth * 4 > base.width) base.width = w.winfo_reqwidth * 4 end - }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], + }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], 'relwidth'=>0.25, 'relheight'=>0.25) } $xpos['space'] = 0.75 diff --git a/ext/tk/sample/demos-en/radio.rb b/ext/tk/sample/demos-en/radio.rb index 25cfac2134..bde31508e1 100644 --- a/ext/tk/sample/demos-en/radio.rb +++ b/ext/tk/sample/demos-en/radio.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio_demo) && $radio_demo - $radio_demo.destroy + $radio_demo.destroy $radio_demo = nil end @@ -21,7 +21,7 @@ $radio_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,11 +30,11 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -59,13 +59,13 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" diff --git a/ext/tk/sample/demos-en/radio2.rb b/ext/tk/sample/demos-en/radio2.rb index 6c02aef0cf..72fc2c610c 100644 --- a/ext/tk/sample/demos-en/radio2.rb +++ b/ext/tk/sample/demos-en/radio2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio2_demo) && $radio2_demo - $radio2_demo.destroy + $radio2_demo.destroy $radio2_demo = nil end @@ -21,7 +21,7 @@ $radio2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio2_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -30,12 +30,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -55,24 +55,24 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'See Variables' command proc{ - showVars(base_frame, + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) } }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', +f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', 'pady'=>2, 'padx'=>2) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_mid.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" @@ -92,15 +92,15 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) abtn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| lower = a.downcase - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>lower, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>lower, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-en/radio3.rb b/ext/tk/sample/demos-en/radio3.rb index 9c9d75ef4a..8a147edda7 100644 --- a/ext/tk/sample/demos-en/radio3.rb +++ b/ext/tk/sample/demos-en/radio3.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio3_demo) && $radio3_demo - $radio3_demo.destroy + $radio3_demo.destroy $radio3_demo = nil end @@ -21,7 +21,7 @@ $radio3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio3_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -35,50 +35,50 @@ size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['size', size], + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) - }), - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'radio3'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'radio3'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $radio3_demo $radio3_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew') } -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', +f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', 'pady'=>2, 'padx'=>2) f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c') -TkButton.new(base_frame, 'text'=>'Tristate', +TkButton.new(base_frame, 'text'=>'Tristate', 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c') } -# radiobutton +# radiobutton [10, 12, 14, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" @@ -101,14 +101,14 @@ TkButton.new(base_frame, 'text'=>'Tristate', }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-en/ruler.rb b/ext/tk/sample/demos-en/ruler.rb index 26cd4f3b1c..a9773699f7 100644 --- a/ext/tk/sample/demos-en/ruler.rb +++ b/ext/tk/sample/demos-en/ruler.rb @@ -21,7 +21,7 @@ end # toplevel widget if defined?($ruler_demo) && $ruler_demo - $ruler_demo.destroy + $ruler_demo.destroy $ruler_demo = nil end @@ -35,7 +35,7 @@ $ruler_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ruler_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."){ pack('side'=>'top') } @@ -58,14 +58,14 @@ $ruler_buttons = TkFrame.new(base_frame) {|frame| } $ruler_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas +# canvas $ruler_canvas = TkCanvas.new(base_frame, 'width'=>'14.8c', 'height'=>'2.5c') $ruler_canvas.pack('side'=>'top', 'fill'=>'x') -# +# unless Struct.const_defined?("RulerInfo") - $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, - :top, :bottom, :size, :normalStyle, + $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, + :top, :bottom, :size, :normalStyle, :activeStyle, :deleteStyle).new end $demo_rulerInfo.grid = '.25c' @@ -77,17 +77,17 @@ $demo_rulerInfo.size = TkWinfo.fpixels($ruler_canvas, '.2c') $demo_rulerInfo.normalStyle = {'fill'=>'black'} if TkWinfo.depth($ruler_canvas) > 1 $demo_rulerInfo.activeStyle = {'fill'=>'red', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'red', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'red', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} else $demo_rulerInfo.activeStyle = {'fill'=>'black', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'black', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'black', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} end -TkcLine.new($ruler_canvas, +TkcLine.new($ruler_canvas, '1c', '0.5c', '1c', '1c', '13c', '1c', '13c', '0.5c', 'width'=>1) (0..11).each{|i| x = i+1 @@ -101,21 +101,21 @@ TkcLine.new($ruler_canvas, $rulerTag_well = TkcTag.new($ruler_canvas) $ruler_canvas\ .addtag_withtag($rulerTag_well, - TkcRectangle.new($ruler_canvas, - '13.2c', '1c', '13.8c', '0.5c', - 'outline'=>'black', + TkcRectangle.new($ruler_canvas, + '13.2c', '1c', '13.8c', '0.5c', + 'outline'=>'black', 'fill'=>($ruler_canvas\ .configinfo('background'))[4]) ) $ruler_canvas\ .addtag_withtag($rulerTag_well, - rulerMkTab($ruler_canvas, - TkWinfo.pixels($ruler_canvas, '13.5c'), + rulerMkTab($ruler_canvas, + TkWinfo.pixels($ruler_canvas, '13.5c'), TkWinfo.pixels($ruler_canvas, '.65c') ) ) $rulerTag_well.bind('1', proc{|x,y| rulerNewTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.itembind('tab', '1', +$ruler_canvas.itembind('tab', '1', proc{|x,y| rulerSelectTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.bind('B1-Motion', +$ruler_canvas.bind('B1-Motion', proc{|x,y| rulerMoveTab($ruler_canvas,x,y)}, '%x %y') $ruler_canvas.bind('Any-ButtonRelease-1', proc{rulerReleaseTab($ruler_canvas)}) diff --git a/ext/tk/sample/demos-en/sayings.rb b/ext/tk/sample/demos-en/sayings.rb index 06ec7c1e75..a4dcf37cdc 100644 --- a/ext/tk/sample/demos-en/sayings.rb +++ b/ext/tk/sample/demos-en/sayings.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($sayings_demo) && $sayings_demo - $sayings_demo.destroy + $sayings_demo.destroy $sayings_demo = nil end @@ -70,11 +70,11 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| sayings_lbox.pack('expand'=>'yes', 'fill'=>'y') else - sayings_lbox.grid('row'=>0, 'column'=>0, + sayings_lbox.grid('row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sv.grid('row'=>0, 'column'=>1, + sv.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sh.grid('row'=>1, 'column'=>0, + sh.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(w, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(w, 0, 'weight'=>1, 'minsize'=>0) diff --git a/ext/tk/sample/demos-en/search.rb b/ext/tk/sample/demos-en/search.rb index e1fc565e9d..7fb40d88b2 100644 --- a/ext/tk/sample/demos-en/search.rb +++ b/ext/tk/sample/demos-en/search.rb @@ -62,13 +62,13 @@ end def textToggle(cmd1,sleep1,cmd2,sleep2) sleep_list = [sleep2, sleep1] - TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, + TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, -1, cmd1, cmd2).start(sleep1) end # toplevel widget if defined?($search_demo) && $search_demo - $search_demo.destroy + $search_demo.destroy $search_demo = nil end @@ -101,35 +101,35 @@ $search_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'File name:', + TkLabel.new(f, 'text'=>'File name:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_fileName = TkVariable.new - TkEntry.new(f, 'width'=>40, + TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_fileName) { pack('side'=>'left') bind('Return', proc{textLoadFile($search_text, $search_fileName.value) $search_string_entry.focus}) focus } - TkButton.new(f, 'text'=>'Load File', - 'command'=>proc{textLoadFile($search_text, + TkButton.new(f, 'text'=>'Load File', + 'command'=>proc{textLoadFile($search_text, $search_fileName.value)})\ .pack('side'=>'left', 'pady'=>5, 'padx'=>10) }.pack('side'=>'top', 'fill'=>'x') TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'Search string:', + TkLabel.new(f, 'text'=>'Search string:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_searchString = TkVariable.new - $search_string_entry = TkEntry.new(f, 'width'=>40, + $search_string_entry = TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_searchString) { pack('side'=>'left') - bind('Return', proc{textSearch($search_text, $search_searchString.value, + bind('Return', proc{textSearch($search_text, $search_searchString.value, $search_Tag)}) } - TkButton.new(f, 'text'=>'Highlight', - 'command'=>proc{textSearch($search_text, - $search_searchString.value, + TkButton.new(f, 'text'=>'Highlight', + 'command'=>proc{textSearch($search_text, + $search_searchString.value, $search_Tag)}) { pack('side'=>'left', 'pady'=>5, 'padx'=>10) } @@ -148,20 +148,20 @@ $search_text = TkText.new(base_frame, 'setgrid'=>true, 'wrap'=>'word') {|t| if TkWinfo.depth($search_demo) > 1 textToggle(proc{ - $search_Tag.configure('background'=>'#ce5555', + $search_Tag.configure('background'=>'#ce5555', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) else textToggle(proc{ - $search_Tag.configure('background'=>'black', + $search_Tag.configure('background'=>'black', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, diff --git a/ext/tk/sample/demos-en/spin.rb b/ext/tk/sample/demos-en/spin.rb index c2a3a8949b..d51b7e6619 100644 --- a/ext/tk/sample/demos-en/spin.rb +++ b/ext/tk/sample/demos-en/spin.rb @@ -5,7 +5,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($spin_demo) && $spin_demo - $spin_demo.destroy + $spin_demo.destroy $spin_demo = nil end @@ -17,8 +17,8 @@ $spin_demo = TkToplevel.new {|w| base_frame = TkFrame.new($spin_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top) Three different spin-boxes are displayed below. \ You can add characters by pointing, clicking and typing. \ @@ -50,16 +50,16 @@ TkFrame.new(base_frame){|f| } australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] [ - TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, + TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, :validatecommand=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' - ]), - TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, - :format=>'%05.2f', :width=>10), + ]), + TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, + :format=>'%05.2f', :width=>10), TkSpinbox.new(base_frame, :values=>australianCities, :width=>10) ].each{|sbox| sbox.pack(:side=>:top, :pady=>5, :padx=>10)} diff --git a/ext/tk/sample/demos-en/states.rb b/ext/tk/sample/demos-en/states.rb index add0e84800..a5c01a867c 100644 --- a/ext/tk/sample/demos-en/states.rb +++ b/ext/tk/sample/demos-en/states.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($states_demo) && $states_demo - $states_demo.destroy + $states_demo.destroy $states_demo = nil end @@ -63,16 +63,16 @@ TkFrame.new(base_frame, 'borderwidth'=>'.5c') {|w| }.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'y') ins_data = [ - 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', - 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', - 'Hawaii', 'Idaho', 'Illinois', - 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', - 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', - 'Montana', 'Nebraska', 'Nevada', 'New_Hampshire', 'New_Jersey', 'New_Mexico', - 'New_York', 'North_Carolina', 'North_Dakota', - 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode_Island', - 'South_Carolina', 'South_Dakota', - 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', + 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', + 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', + 'Hawaii', 'Idaho', 'Illinois', + 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', + 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', + 'Montana', 'Nebraska', 'Nevada', 'New_Hampshire', 'New_Jersey', 'New_Mexico', + 'New_York', 'North_Carolina', 'North_Dakota', + 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode_Island', + 'South_Carolina', 'South_Dakota', + 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West_Virginia', 'Wisconsin', 'Wyoming' ] diff --git a/ext/tk/sample/demos-en/style.rb b/ext/tk/sample/demos-en/style.rb index c2fed23926..5c8777379e 100644 --- a/ext/tk/sample/demos-en/style.rb +++ b/ext/tk/sample/demos-en/style.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($style_demo) && $style_demo - $style_demo.destroy + $style_demo.destroy $style_demo = nil end @@ -38,9 +38,9 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# text +# text txt = TkText.new(base_frame){|t| - # + # setgrid 'true' #width 70 #height 32 @@ -53,7 +53,7 @@ txt = TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # family = 'Courier' if $tk_version =~ /^4.*/ @@ -76,44 +76,44 @@ txt = TkText.new(base_frame){|t| # when /^8.*/ # unless $style_demo_do_first # $style_demo_do_first = true -# Tk.tk_call('font', 'create', '@bigascii', +# Tk.tk_call('font', 'create', '@bigascii', # '-copy', '-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*') -# Tk.tk_call('font', 'create', '@smallascii', +# Tk.tk_call('font', 'create', '@smallascii', # '-copy', '-Adobe-Helvetica-Bold-R-Normal-*-100-*') -# Tk.tk_call('font', 'create', '@cBigFont', +# Tk.tk_call('font', 'create', '@cBigFont', # '-compound', '@bigascii @msg_knj') -# Tk.tk_call('font', 'create', '@cSmallFont', +# Tk.tk_call('font', 'create', '@cSmallFont', # '-compound', '@smallascii @kanji') # end # style_tag_big = TkTextTag.new(t, 'font'=>'@cBigFont') # style_tag_small = TkTextTag.new(t, 'font'=>'@cSmallFont') # end - # + # if TkWinfo.depth($root).to_i > 1 style_tag_color1 = TkTextTag.new(t, 'background'=>'#a0b7ce') style_tag_color2 = TkTextTag.new(t, 'foreground'=>'red') style_tag_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1) style_tag_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1) else - style_tag_color1 = TkTextTag.new(t, 'background'=>'black', + style_tag_color1 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_color2 = TkTextTag.new(t, 'background'=>'black', + style_tag_color2 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_raised = TkTextTag.new(t, 'background'=>'white', + style_tag_raised = TkTextTag.new(t, 'background'=>'white', 'relief'=>'raised', 'borderwidth'=>1) - style_tag_sunken = TkTextTag.new(t, 'background'=>'white', + style_tag_sunken = TkTextTag.new(t, 'background'=>'white', 'relief'=>'sunken', 'borderwidth'=>1) end - # + # if $tk_version =~ /^4\.[01]/ - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray25') else - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray12') end style_tag_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50') @@ -134,7 +134,7 @@ txt = TkText.new(base_frame){|t| 'lmargin1'=>'12m', 'lmargin2'=>'6m', 'rmargin'=>'10m') - # + # insert('end', 'Text widgets like this one allow you to display information in a variety of styles. Display styles are controlled using a mechanism called ') diff --git a/ext/tk/sample/demos-en/text.rb b/ext/tk/sample/demos-en/text.rb index 3ce8cdfda8..5794a85e87 100644 --- a/ext/tk/sample/demos-en/text.rb +++ b/ext/tk/sample/demos-en/text.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($text_demo) && $text_demo - $text_demo.destroy + $text_demo.destroy $text_demo = nil end @@ -45,7 +45,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# text +# text TkText.new(base_frame){|t| relief 'sunken' bd 2 @@ -62,7 +62,7 @@ TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # insert('0.0', <"text#{cnt}") sbar = TkScrollbar.new(win, :widgetname=>"sb#{cnt}") peer.yscrollbar sbar - b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', + b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', :command=>proc{makeClone(count, win, peer)}) - b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', + b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', :command=>proc{killClone(win, cnt)}) row = cnt * 2 TkGrid.configure(peer, sbar, b1, :sticky=>'nsew', :row=>row) @@ -51,7 +51,7 @@ def makeClone(count, win, txt) end def killClone(win, cnt) - Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", + Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", "#{win.path}.clone#{cnt}", "#{win.path}.kill#{cnt}") end diff --git a/ext/tk/sample/demos-en/toolbar.rb b/ext/tk/sample/demos-en/toolbar.rb index 633c52c15d..e7cbeb4235 100644 --- a/ext/tk/sample/demos-en/toolbar.rb +++ b/ext/tk/sample/demos-en/toolbar.rb @@ -5,7 +5,7 @@ # based on "Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($toolbar_demo) && $toolbar_demo - $toolbar_demo.destroy + $toolbar_demo.destroy $toolbar_demo = nil end @@ -18,7 +18,7 @@ $toolbar_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true) if Tk.windowingsystem != 'aqua' - msg = Ttk::Label.new(base_frame, :wraplength=>'4i', + msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=>Tk::UTF8_String.new(<'4i', + msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=>Tk::UTF8_String.new(<40, :height=>10) ## Toolbar contents -tb_btn = Ttk::Button.new(tbar_base, :text=>'Button', :style=>'Toolbutton', +tb_btn = Ttk::Button.new(tbar_base, :text=>'Button', :style=>'Toolbutton', :command=>proc{text.insert(:end, "Button Pressed\n")}) -tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'Check', :style=>'Toolbutton', - :variable=>(check = TkVariable.new), +tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'Check', :style=>'Toolbutton', + :variable=>(check = TkVariable.new), :command=>proc{ text.insert(:end, "Check is #{check.value}\n") }) tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'Menu') -tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, +tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, :state=>:readonly) tb_mbtn.menu(menu = Tk::Menu.new(tb_mbtn)) menu.add(:command, :label=>'Just', :command=>proc{text.insert(:end, "Just\n")}) menu.add(:command, :label=>'An', :command=>proc{text.insert(:end, "An\n")}) -menu.add(:command, :label=>'Example', +menu.add(:command, :label=>'Example', :command=>proc{text.insert(:end, "Example\n")}) tb_combo.bind(''){ text.font.family = tb_combo.get } ## Arrange contents -Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, +Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, :in=>contents, :padx=>2, :sticky=>'ns') Tk.grid(tbar_base, :sticky=>'ew') Tk.grid(sep, :sticky=>'ew') @@ -114,16 +114,16 @@ base_frame.grid_columnconfigure(text, :weight=>1) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'toolbar'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'toolbar'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $toolbar_demo.destroy $toolbar_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) Tk.grid(frame, :sticky=>'ew') diff --git a/ext/tk/sample/demos-en/tree.rb b/ext/tk/sample/demos-en/tree.rb index 0c7f0e71a2..cd62ba8c9b 100644 --- a/ext/tk/sample/demos-en/tree.rb +++ b/ext/tk/sample/demos-en/tree.rb @@ -6,7 +6,7 @@ # based on "Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($tree_demo) && $tree_demo - $tree_demo.destroy + $tree_demo.destroy $tree_demo = nil end @@ -19,8 +19,8 @@ $tree_demo = TkToplevel.new {|w| base_frame = TkFrame.new($tree_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ @@ -37,16 +37,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'tree'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'tree'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $tree_demo.destroy $tree_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -55,7 +55,7 @@ Ttk::Frame.new(base_frame) {|frame| ## Code to populate the roots of the tree (can be more than one on Windows) def populate_roots(tree) TkComm.simplelist(Tk.tk_call('file', 'volumes')).sort.each{|dir| - populate_tree(tree, tree.insert(nil, :end, :text=>dir, + populate_tree(tree, tree.insert(nil, :end, :text=>dir, :values=>[dir, 'directory'])) } end @@ -68,7 +68,7 @@ def populate_tree(tree, node) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| type = File.ftype(f) - id = tree.insert(node, :end, + id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' ## Make it so that this node is openable @@ -94,7 +94,7 @@ def populate_tree(tree, node) end ## Create the tree and set it up -tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), :displaycolumns=>['size']) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) diff --git a/ext/tk/sample/demos-en/ttkbut.rb b/ext/tk/sample/demos-en/ttkbut.rb index b5780f589a..a784efcc08 100644 --- a/ext/tk/sample/demos-en/ttkbut.rb +++ b/ext/tk/sample/demos-en/ttkbut.rb @@ -7,7 +7,7 @@ # based on "Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($ttkbut_demo) && $ttkbut_demo - $ttkbut_demo.destroy + $ttkbut_demo.destroy $ttkbut_demo = nil end @@ -19,7 +19,7 @@ $ttkbut_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkbut_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) Ttk is the new Tk themed widget set. This is a Ttk themed label, \ and below are three groups of Ttk widgets in Ttk labelframes. \ @@ -34,11 +34,11 @@ EOL ## Add buttons for setting the theme buttons = Ttk::Labelframe.new(base_frame, :text=>'Buttons') # Ttk::Style.theme_names.each{|theme| -# Ttk::Button.new(buttons, :text=>theme, +# Ttk::Button.new(buttons, :text=>theme, # :command=>proc{Ttk::Style.theme_use theme}).pack(:pady=>2) # } Ttk.themes.each{|theme| - Ttk::Button.new(buttons, :text=>theme, + Ttk::Button.new(buttons, :text=>theme, :command=>proc{Ttk.set_theme theme}).pack(:pady=>2) } @@ -62,9 +62,9 @@ end ## Set up the checkbutton group checks = Ttk::Labelframe.new(base_frame, :text=>'Checkbuttons') enabled = TkVariable.new(true) -e = Ttk::Checkbutton.new(checks, :text=>'Enabled', :variable=>enabled, +e = Ttk::Checkbutton.new(checks, :text=>'Enabled', :variable=>enabled, :command=>proc{ - setState($ttkbut_demo, + setState($ttkbut_demo, ((enabled.bool)? "!disabled" : "disabled"), e) }) @@ -90,15 +90,15 @@ radios = Ttk::Labelframe.new(base_frame, :text=>'Radiobuttons') happyness = TkVariable.new -r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Great', :value=>'great') -r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Good', :value=>'good') -r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Ok', :value=>'ok') -r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Poor', :value=>'poor') -r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Awful', :value=>'awful') Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) @@ -107,26 +107,26 @@ Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['enabled', enabled], - ['cheese', cheese], ['tomato', tomato], - ['basil', basil], ['oregano', oregano], + showVars(base_frame, ['enabled', enabled], + ['cheese', cheese], ['tomato', tomato], + ['basil', basil], ['oregano', oregano], ['happyness', happyness]) - }), - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkbut'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkbut'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $ttkbut_demo $ttkbut_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x, :expand=>true) diff --git a/ext/tk/sample/demos-en/ttkmenu.rb b/ext/tk/sample/demos-en/ttkmenu.rb index 75ecdb09c4..9399568313 100644 --- a/ext/tk/sample/demos-en/ttkmenu.rb +++ b/ext/tk/sample/demos-en/ttkmenu.rb @@ -6,7 +6,7 @@ # based on "Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkmenu_demo) && $ttkmenu_demo - $ttkmenu_demo.destroy + $ttkmenu_demo.destroy $ttkmenu_demo = nil end @@ -18,7 +18,7 @@ $ttkmenu_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($ttkmenu_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) Ttk is the new Tk themed widget set, \ and one widget that is available in themed form is the menubutton. \ @@ -39,16 +39,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new($ttkmenu_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkmenu'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkmenu'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkmenu_demo.destroy $ttkmenu_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) diff --git a/ext/tk/sample/demos-en/ttknote.rb b/ext/tk/sample/demos-en/ttknote.rb index c2a22b447a..bc0c7b369a 100644 --- a/ext/tk/sample/demos-en/ttknote.rb +++ b/ext/tk/sample/demos-en/ttknote.rb @@ -6,7 +6,7 @@ # based on "Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp" if defined?($ttknote_demo) && $ttknote_demo - $ttknote_demo.destroy + $ttknote_demo.destroy $ttknote_demo = nil end @@ -20,16 +20,16 @@ $ttknote_demo = TkToplevel.new {|w| Ttk::Frame.new($ttknote_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttknote'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttknote'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttknote_demo.destroy $ttknote_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -38,13 +38,13 @@ Ttk::Frame.new($ttknote_demo) {|frame| base_frame = Ttk::Frame.new($ttknote_demo).pack(:fill=>:both, :expand=>true) ## Make the notebook and set up Ctrl+Tab traversal -notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, +notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, :padx=>2, :pady=>3) notebook.enable_traversal ## Popuplate the first pane f_msg = Ttk::Frame.new(notebook) -msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'4i', +msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'4i', :justify=>:left, :anchor=>'n', :text=><'Neat!', :underline=>0, +msg_b = Ttk::Button.new(f_msg, :text=>'Neat!', :underline=>0, :command=>proc{ neat.value = 'Yeah, I know...' Tk.after_cancel(after_id) if after_id diff --git a/ext/tk/sample/demos-en/ttkpane.rb b/ext/tk/sample/demos-en/ttkpane.rb index 56df613db4..87c4dedeb2 100644 --- a/ext/tk/sample/demos-en/ttkpane.rb +++ b/ext/tk/sample/demos-en/ttkpane.rb @@ -5,7 +5,7 @@ # based on "Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkpane_demo) && $ttkpane_demo - $ttkpane_demo.destroy + $ttkpane_demo.destroy $ttkpane_demo = nil end @@ -17,7 +17,7 @@ $ttkpane_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkpane_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) This demonstration shows off a nested set of themed paned windows. \ Their sizes can be changed by grabbing the area \ @@ -30,16 +30,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkpane'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkpane'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkpane_demo.destroy $ttkpane_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -59,25 +59,25 @@ if Tk.windowingsystem == 'aqua' end # Fill the button pane -Ttk::Button.new(left_top, :text=>'Press Me', +Ttk::Button.new(left_top, :text=>'Press Me', :command=>proc{ - Tk.messageBox(:type=>'ok', :icon=>'info', :message=>'Ouch!', - :detail=>'That hurt...', :parent=>base_frame, + Tk.messageBox(:type=>'ok', :icon=>'info', :message=>'Ouch!', + :detail=>'That hurt...', :parent=>base_frame, :title=>'Button Pressed') }).pack(:padx=>2, :pady=>5) zones_list = [ - [':Europe/Berlin'], - [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], - [':Africa/Johannesburg'], - [':Europe/London'], - [':America/Los_Angeles'], + [':Europe/Berlin'], + [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], + [':Africa/Johannesburg'], + [':Europe/London'], + [':America/Los_Angeles'], [':Europe/Moscow'], - [':America/New_York'], - [':Asia/Singapore'], - [':Australia/Sydney'], - [':Asia/Tokyo'], + [':America/New_York'], + [':Asia/Singapore'], + [':Australia/Sydney'], + [':Asia/Tokyo'], ] zones = [] @@ -155,7 +155,7 @@ time = TkVariable.new_hash case tzinfo when :tcl update_proc = proc{|now, tz, label| - time[label] = Tk.tk_call('clock', 'format', now.tv_sec, + time[label] = Tk.tk_call('clock', 'format', now.tv_sec, '-timezone', tz, '-format', '%T') } when :tzinfo @@ -176,7 +176,7 @@ end zones.each_with_index{|(zone, label), idx| Ttk::Separator.new(left_bot).pack(:fill=>:x) if idx > 0 Ttk::Label.new(left_bot, :text=>label, :anchor=>'w').pack(:fill=>:x) - Ttk::Label.new(left_bot, :textvariable=>time.ref(label), + Ttk::Label.new(left_bot, :textvariable=>time.ref(label), :anchor=>'w').pack(:fill=>:x) } diff --git a/ext/tk/sample/demos-en/ttkprogress.rb b/ext/tk/sample/demos-en/ttkprogress.rb index 3eb9a64a4a..c341a9385f 100644 --- a/ext/tk/sample/demos-en/ttkprogress.rb +++ b/ext/tk/sample/demos-en/ttkprogress.rb @@ -5,7 +5,7 @@ # based on "Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkprogress_demo) && $ttkprogress_demo - $ttkprogress_demo.destroy + $ttkprogress_demo.destroy $ttkprogress_demo = nil end @@ -17,7 +17,7 @@ $ttkprogress_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=>Tk::UTF8_String.new(<:top, :fill=>:x) Below are two progress bars. \ The top one is a \\u201Cdeterminate\\u201D progress bar, \ @@ -32,16 +32,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkprogress'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkprogress'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkprogress_demo.destroy $ttkprogress_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -52,9 +52,9 @@ frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) p1 = Ttk::Progressbar.new(frame, :mode=>:determinate) p2 = Ttk::Progressbar.new(frame, :mode=>:indeterminate) -start = Ttk::Button.new(frame, :text=>'Start Progress', +start = Ttk::Button.new(frame, :text=>'Start Progress', :command=>proc{ p1.start; p2.start }) -stop = Ttk::Button.new(frame, :text=>'Stop Progress', +stop = Ttk::Button.new(frame, :text=>'Stop Progress', :command=>proc{ p1.stop; p2.stop }) Tk.grid(p1, '-', :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-en/twind.rb b/ext/tk/sample/demos-en/twind.rb index 65ee712ff7..60a345d0b4 100644 --- a/ext/tk/sample/demos-en/twind.rb +++ b/ext/tk/sample/demos-en/twind.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($twind_demo) && $twind_demo - $twind_demo.destroy + $twind_demo.destroy $twind_demo = nil end @@ -41,10 +41,10 @@ $twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame $twind_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| - $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, - 'width'=>'70', 'height'=>35, 'wrap'=>'word', + $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, + 'width'=>'70', 'height'=>35, 'wrap'=>'word', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -53,12 +53,12 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') }.pack('expand'=>'yes', 'fill'=>'both') -# -$tag_center = TkTextTag.new($twind_text, +# +$tag_center = TkTextTag.new($twind_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag_buttons = TkTextTag.new($twind_text, +$tag_buttons = TkTextTag.new($twind_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -71,7 +71,7 @@ $twind_text.insert('end', "it. These are called \"embedded windows\", ") $twind_text.insert('end', "and they can consist of arbitrary widgets. ") $twind_text.insert('end', "For example, here are two embedded button ") $twind_text.insert('end', "widgets. You can click on the first button to ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'ON' text 'Turn On' @@ -81,7 +81,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', " horizontal scrolling, which also turns off ") $twind_text.insert('end', "word wrapping. Or, you can click on the second ") $twind_text.insert('end', "button to\n") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'OFF' text 'Turn Off' @@ -91,7 +91,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n") $twind_text.insert('end', "Or, here is another example. If you ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text 'Click Here' command proc{textWindPlot $twind_text} @@ -102,7 +102,7 @@ $mark_plot = TkTextMark.new($twind_text, 'insert') $mark_plot.gravity='left' $twind_text.insert('end', " You can drag the data points around with the mouse, ") $twind_text.insert('end', "or you can click here to ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text 'Delete' command proc{textWindDel $twind_text} @@ -124,7 +124,7 @@ $twind_text.insert('end', "changes the layout. Click on the button again ") $twind_text.insert('end', "to restore the short string.\n") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) {|b| text 'Default' command proc{embDefBg $twind_text} @@ -133,7 +133,7 @@ TkTextWindow.new($twind_text, 'end', }, 'padx'=>3 ) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkCheckButton.new($twind_text) { textvariable embToggle indicatoron 0 @@ -144,25 +144,25 @@ TkTextWindow.new($twind_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind_text, 'end', + TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text twind_color cursor 'top_left_arrow' command proc{$twind_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } -# +# def textWindOn (w,f) if defined? $twind_scroll begin @@ -216,39 +216,39 @@ def textWindPlot (t) TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind_plot, 225, 20, + TkcText.new($twind_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind_plot, x, 254, + TkcText.new($twind_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind_plot, 96, y, + TkcText.new($twind_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind_plot.itembind('point', 'Any-Enter', + $twind_plot.itembind('point', 'Any-Enter', proc{$twind_plot.itemconfigure 'current', 'fill', 'red'}) - $twind_plot.itembind('point', 'Any-Leave', + $twind_plot.itembind('point', 'Any-Leave', proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind_plot.itembind('point', '1', + $twind_plot.itembind('point', '1', proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y") - $twind_plot.itembind('point', 'ButtonRelease-1', + $twind_plot.itembind('point', 'ButtonRelease-1', proc{$twind_plot.dtag 'selected'}) - $twind_plot.bind('B1-Motion', + $twind_plot.bind('B1-Motion', proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y") while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot diff --git a/ext/tk/sample/demos-en/twind2.rb b/ext/tk/sample/demos-en/twind2.rb index 43990c1151..af7313dd82 100644 --- a/ext/tk/sample/demos-en/twind2.rb +++ b/ext/tk/sample/demos-en/twind2.rb @@ -4,7 +4,7 @@ # delete toplevel widget if defined?($twind2_demo) && $twind2_demo - $twind2_demo.destroy + $twind2_demo.destroy $twind2_demo = nil end @@ -19,20 +19,20 @@ base_frame = TkFrame.new($twind2_demo).pack(:fill=>:both, :expand=>true) # frame $twind2_buttons = TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'twind2'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'twind2'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $twind2_demo $twind2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) } @@ -40,11 +40,11 @@ $twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame $twind2_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font, - # 'width'=>'70', 'height'=>35, 'wrap'=>'word', - 'width'=>'70', 'height'=>35, 'wrap'=>'char', + # 'width'=>'70', 'height'=>35, 'wrap'=>'word', + 'width'=>'70', 'height'=>35, 'wrap'=>'char', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -54,11 +54,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # text tags -$tag2_center = TkTextTag.new($twind2_text, +$tag2_center = TkTextTag.new($twind2_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag2_buttons = TkTextTag.new($twind2_text, +$tag2_buttons = TkTextTag.new($twind2_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -67,7 +67,7 @@ $tag2_buttons = TkTextTag.new($twind2_text, 'spacing3'=>0 ) # insert text -$twind2_text.insert('end', +$twind2_text.insert('end', 'A text widget can contain many different kinds of items, ') $twind2_text.insert('end', "both active and passive. It can lay these out in various ") @@ -82,7 +82,7 @@ $twind2_text.insert('end', "it. These are called \"embedded windows\", ") $twind2_text.insert('end', "and they can consist of arbitrary widgets. ") $twind2_text.insert('end', "For example, here are two embedded button ") $twind2_text.insert('end', "widgets. You can click on the first button to ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'ON' command proc{textWindOn2 $twind2_text,$twind2_buttons} @@ -91,30 +91,30 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', " horizontal scrolling, which also turns off ") $twind2_text.insert('end', "word wrapping. Or, you can click on the second ") $twind2_text.insert('end', "button to\n") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'OFF' command proc{textWindOff2 $twind2_text} cursor 'top_left_arrow' }) -$twind2_text.insert('end', +$twind2_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n") $twind2_text.insert('end', "Or, here is another example. If you ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'Click Here' command proc{textWindPlot2 $twind2_text} cursor 'top_left_arrow' }) -$twind2_text.insert('end', +$twind2_text.insert('end', " a canvas displaying an x-y plot will appear right here.") $mark2_plot = TkTextMark.new($twind2_text, 'insert') $mark2_plot.gravity='left' -$twind2_text.insert('end', +$twind2_text.insert('end', " You can drag the data points around with the mouse, ") $twind2_text.insert('end', "or you can click here to ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'Delete' command proc{textWindDel2 $twind2_text} @@ -122,19 +122,19 @@ TkTextWindow.new($twind2_text, 'end', }) $twind2_text.insert('end', " the plot again.\n\n") -$twind2_text.insert('end', +$twind2_text.insert('end', "You may also find it useful to put embedded windows in ") -$twind2_text.insert('end', +$twind2_text.insert('end', "a text without any actual text. In this case the ") $twind2_text.insert('end', "text widget acts like a geometry manager. For ") -$twind2_text.insert('end', +$twind2_text.insert('end', "example, here is a collection of buttons laid out ") -$twind2_text.insert('end', +$twind2_text.insert('end', "neatly into rows by the text widget. These buttons ") -$twind2_text.insert('end', +$twind2_text.insert('end', "can be used to change the background color of the ") $twind2_text.insert('end', "text widget (\"Default\" restores the color to ") -$twind2_text.insert('end', +$twind2_text.insert('end', "its default). If you click on the button labeled ") $twind2_text.insert('end', "\"Short\", it changes to a longer string so that ") $twind2_text.insert('end', "you can see how the text widget automatically ") @@ -148,7 +148,7 @@ btn_default = TkButton.new($twind2_text) {|b| } TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkCheckButton.new($twind2_text) { textvariable embToggle indicatoron 0 @@ -159,21 +159,21 @@ TkTextWindow.new($twind2_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind2_text, 'end', + TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text twind_color cursor 'top_left_arrow' command proc{$twind2_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -187,54 +187,54 @@ $text_normal2['pad'] = $twind2_text.cget('padx') $twind2_text.insert('end', "\nYou can also change the usual border width and ") $twind2_text.insert('end', "highlightthickness and padding.\n") -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text, :text=>"Small highlight", - :cursor=>'top_left_arrow', + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigP2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallP2 $twind2_text })) -$twind2_text.insert('end', +$twind2_text.insert('end', "\n\nFinally, images fit comfortably in text widgets too:") -TkTextImage.new($twind2_text, 'end', +TkTextImage.new($twind2_text, 'end', 'image'=>TkBitmapImage.new(:file=>[ - $demo_dir, '..', + $demo_dir, '..', 'images', 'face.xbm' ].join(File::Separator))) @@ -309,39 +309,39 @@ def textWindPlot2 (t) TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind2_plot, 225, 20, + TkcText.new($twind2_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind2_plot, x, 254, + TkcText.new($twind2_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind2_plot, 96, y, + TkcText.new($twind2_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind2_plot.itembind('point', 'Any-Enter', + $twind2_plot.itembind('point', 'Any-Enter', proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'}) - $twind2_plot.itembind('point', 'Any-Leave', + $twind2_plot.itembind('point', 'Any-Leave', proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind2_plot.itembind('point', '1', + $twind2_plot.itembind('point', '1', proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y") - $twind2_plot.itembind('point', 'ButtonRelease-1', + $twind2_plot.itembind('point', 'ButtonRelease-1', proc{$twind2_plot.dtag 'selected'}) - $twind2_plot.bind('B1-Motion', + $twind2_plot.bind('B1-Motion', proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y") while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot diff --git a/ext/tk/sample/demos-en/unicodeout.rb b/ext/tk/sample/demos-en/unicodeout.rb index 9c230a2536..ee7b5afa15 100644 --- a/ext/tk/sample/demos-en/unicodeout.rb +++ b/ext/tk/sample/demos-en/unicodeout.rb @@ -6,7 +6,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($unicodeout_demo) && $unicodeout_demo - $unicodeout_demo.destroy + $unicodeout_demo.destroy $unicodeout_demo = nil end @@ -18,8 +18,8 @@ $unicodeout_demo = TkToplevel.new {|w| base_frame = TkFrame.new($unicodeout_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5.4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5.4i', :justify=>:left, :text=><:top) This is a sample of Tk's support for languages that use non-Western \ character sets. However, what you will actually see below depends \ @@ -32,10 +32,10 @@ the definition of @@font on the Unicodeout_SampleFrame class. The strings are written in Tcl using UNICODE characters \ using the \\uXXXX escape so as to do so in a portable fashion. -ATTENTION: +ATTENTION: The strings are converted to the encoded string objects \ (completed to rewrite Tcl's escapes) by Tk::UTF8_String method. \ -And the Tk::UTF8_String objects are passed to the label widgets. +And the Tk::UTF8_String objects are passed to the label widgets. EOL TkFrame.new(base_frame){|f| @@ -51,8 +51,8 @@ TkFrame.new(base_frame){|f| }).pack(:side=>:left, :expand=>true) } -wait_msg = TkLabel.new(base_frame, - :text=>"Please wait while loading fonts...", +wait_msg = TkLabel.new(base_frame, + :text=>"Please wait while loading fonts...", :font=>"Helvetica 12 italic").pack class Unicodeout_SampleFrame < TkFrame @@ -72,10 +72,10 @@ class Unicodeout_SampleFrame < TkFrame def add_sample(lang, *args) sample_txt = Tk::UTF8_String(args.join('')) - l = TkLabel.new(self, :font=>@@font, :text=>lang+':', + l = TkLabel.new(self, :font=>@@font, :text=>lang+':', :anchor=>:nw, :pady=>0) - #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, - s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, + #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, + s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, :anchor=>:nw, :width=>30, :pady=>0) Tk.grid(l, s, :sticky=>:ew, :pady=>0) l.grid_config(:padx, '1m') @@ -91,23 +91,23 @@ oldCursor = $unicodeout_demo.cursor $unicodeout_demo.cursor('watch') Tk.update -f.add_sample('Arabic', - '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', +f.add_sample('Arabic', + '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', '\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D') f.add_sample('Trad. Chinese', '\u4E2D\u570B\u7684\u6F22\u5B57') f.add_sample('Simpl. Chinese', '\u6C49\u8BED') -f.add_sample('Greek', - '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', +f.add_sample('Greek', + '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', '\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1') -f.add_sample('Hebrew', - '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', +f.add_sample('Hebrew', + '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', '\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9') -f.add_sample('Japanese', - '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', +f.add_sample('Japanese', + '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', '\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA') f.add_sample('Korean', '\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00') -f.add_sample('Russian', - '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', +f.add_sample('Russian', + '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', '\u044F\u0437\u044B\u043A') wait_msg.destroy -- cgit v1.2.3