From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-05-20T16:51:28+09:00 Subject: problem deleting item on a TkCanvas I've got a TkCanvas where I initially draw a vertical line at the far left of the canvas. I've bound the left mouse button such that when pressed a new vertical line is drawn at that x location, and the old line is _supposed_ to be erased (deleted). But the old line is not being deleted. Here's the code: require 'tk' class SigWave def initialize(root,signame) @frame = TkFrame.new(root).pack('anchor' => 'e','padx'=>1,'pady'=>1) @name = TkLabel.new(@frame){text "#{signame}"}.pack('side'=>'left') @canvas = TkCanvas.new(@frame) @canvas.configure 'height'=> 20 @canvas.pack('side'=>'right', 'fill'=>'x') @cursor=TkcLine.new(@canvas, 1,0,1,20).fill('blue') @canvas.bind('1',proc{|e| draw_cursor(e.x) }) draw_cursor(1) end def draw_cursor(x) @canvas.delete(@cursor) #<= this seems to do nothing @cursor=TkcLine.new(@canvas, x,0,x,20).fill('blue') end end root = TkRoot.new() {title "Waveform" } SigWave.new(root,'signame') Tk.mainloop #end of code Am I doing the @canvas.delete correctly? Phil