サンプルのtkline.rbを借りて作った以下のようなプログラムなんですが、
マウスを押したりドラッグしたり離したりしていないと、スレッドの中身が
動いてくれません。なぜなんでしょう?

M.Kanemitsu

−−−
$tk_thread_safe = true
require "tkclass"

Width = 400
Height = 400

$c = Canvas.new {
       width Width
       height Height
     }
$c.pack

$c_rect = Rectangle.new($c, 0, 0, Width+1, Height+1)
$c_rect.fill "white"





def start_calc(a, b, c, d)
  if defined? Thread
    Thread.start do
      for y in 2 .. Height
        for x in 1 .. Width
p [x, y]
          line = Line.new($c, x, y, x+1, y+1)
        end
      end
    end
  end
end

start_calc(1, 1, Width, Height)



$start_x = $start_y = 0

def do_press(x, y)
  $start_x = x
  $start_y = y
  $current_rect = Rectangle.new($c, x, y, x, y)
end

def do_motion(x, y)
  if $current_rect
    $current_rect.coords $start_x, $start_y, x, y
  end
end

def do_release(x, y)
  if $current_rect
    $current_rect.coords $start_x, $start_y, x, y
$current_rect.destroy
    $current_rect = nil
#    $c_rect.raise
  end
end

$c.bind("1", proc{|e| do_press e.x, e.y})
$c.bind("B1-Motion", proc{|x, y| do_motion x, y}, "%x %y")
$c.bind("ButtonRelease-1", proc{|x, y| do_release x, y}, "%x %y")

Tk.mainloop
−−−