require 'tk' require 'tkmove.rb' c = TkCanvas.new.pack TkcText.new(c, 140, 20, 'text'=>'sin(x)') TkcLine.new(c, 50, 100, 230, 100) TkcLine.new(c, 50, 20, 50, 180) plot_data = [50,100] for i in 1..180 x1, y1 = 50 + i, 100 - 50 * Math.sin( i / 90.0 * Math::PI) plot_data += [x1, y1] end eval( "TkcLine.new(c," + plot_data.join(',')+ ", 'width'=>2 ).addtag('item')" ) move = TkMove.new( c, 'item' ) Tk.mainloop