diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
commit | 287a34ae0dfc23e4158f67cb7783d239f202c368 (patch) | |
tree | 5e35d5b41aae961b37cf6632f60c42f51c7aa775 /ext/tk/sample/demos-jp/plot.rb | |
parent | 9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff) |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/plot.rb')
-rw-r--r-- | ext/tk/sample/demos-jp/plot.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb index 9ff71904cd..a49ed00df8 100644 --- a/ext/tk/sample/demos-jp/plot.rb +++ b/ext/tk/sample/demos-jp/plot.rb @@ -5,7 +5,7 @@ # toplevel widget が存在すれば削除する if defined?($plot_demo) && $plot_demo - $plot_demo.destroy + $plot_demo.destroy $plot_demo = nil end @@ -19,7 +19,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'=>"このウィンドウは簡単な2次元のプロットを含んだキャンバス widgetです。表示された点をマウスボタン1でドラッグしてデータをいじることができます。"){ pack('side'=>'top') } @@ -57,45 +57,45 @@ $plot_canvas.pack('side'=>'top', 'fill'=>'x') # 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'=>"簡単なプロット", '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: |