diff options
Diffstat (limited to 'ext/tk/sample/demos-jp/plot.rb')
-rw-r--r-- | ext/tk/sample/demos-jp/plot.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb index c8025d8bf9..902b144f72 100644 --- a/ext/tk/sample/demos-jp/plot.rb +++ b/ext/tk/sample/demos-jp/plot.rb @@ -17,7 +17,7 @@ $plot_demo = TkToplevel.new {|w| # label ���� TkLabel.new($plot_demo, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', - 'text'=>"���Υ�����ɥ��ϴ�ñ��2�����Υץ��åȤ�ޤ�������Х� widget�Ǥ���ɽ�����줿����ޥ����ܥ���1�ǥɥ�å����ƥǡ������뤳�Ȥ��Ǥ��ޤ���"){ + 'text'=>"���Υ�����ɥ��ϴ�ñ��2�����Υץ��åȤ�ޤ�������Х� widget�Ǥ���ɽ�����줿����ޥ����ܥ���1�ǥɥ�å����ƥǡ������뤳�Ȥ��Ǥ��ޤ���"){ pack('side'=>'top') } @@ -51,39 +51,39 @@ $plot_canvas.pack('side'=>'top', 'fill'=>'x') 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, - 'text'=>"��ñ�ʥץ��å�", 'font'=>plotFont, 'fill'=>'brown') + '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, - 'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n') + '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, - 'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e') + '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, - 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') + 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end $plot_canvas.itembind('point', 'Any-Enter', - proc{$plot_canvas.itemconfigure 'current','fill','red'}) + proc{$plot_canvas.itemconfigure 'current','fill','red'}) $plot_canvas.itembind('point', 'Any-Leave', - proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) + proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) $plot_canvas.itembind('point', '1', - proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") + proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") $plot_canvas.itembind('point', 'ButtonRelease-1', - proc{$plot_canvas.dtag 'selected'}) + proc{$plot_canvas.dtag 'selected'}) $plot_canvas.bind('B1-Motion', - proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") + proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") $plot = {'lastX'=>0, 'lastY'=>0} @@ -92,8 +92,8 @@ $plot = {'lastX'=>0, 'lastY'=>0} # data points. It sets up state to allow the point to be dragged. # # Arguments: -# w - The canvas window. -# x, y - The coordinates of the mouse press. +# w - The canvas window. +# x, y - The coordinates of the mouse press. def plotDown (w, x, y) w.dtag 'selected' @@ -108,8 +108,8 @@ end # current item. # # Arguments: -# w - The canvas window. -# x, y - The coordinates of the mouse. +# w - The canvas window. +# x, y - The coordinates of the mouse. def plotMove (w, x, y) w.move 'selected', x - $plot['lastX'], y - $plot['lastY'] |