[#1381] bound method — shugo@... (Shugo Maeda)

前田です。

21 messages 1998/02/04
[#1383] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/05

まつもと ゆきひろです

[#1384] Re: bound method — keiju@... (石塚圭樹 ) 1998/02/05

けいじゅ@日本ラショナルソフトウェアです.

[#1385] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/05

まつもと ゆきひろです

[#1387] Re: bound method — keiju@... (石塚圭樹 ) 1998/02/05

けいじゅ@日本ラショナルソフトウェアです.

[#1388] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/05

まつもと ゆきひろです

[#1389] Re: bound method — keiju@... (石塚圭樹 ) 1998/02/05

けいじゅ@日本ラショナルソフトウェアです.

[#1396] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/06

まつもと ゆきひろです

[#1410] GD — Masao Kanemitsu <masao-k@...>

30 messages 1998/02/10
[#1411] Re: GD — matz@... (Yukihiro Matsumoto) 1998/02/10

まつもと ゆきひろです

[#1413] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1417] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/10

<199802100623.PAA03533@eban.ase.ptg.sony.co.jp> の、

[#1420] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1426] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/10

<199802100733.QAA04028@eban.ase.ptg.sony.co.jp> の、

[#1428] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1429] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/10

<199802100757.QAA04212@eban.ase.ptg.sony.co.jp> の、

[#1431] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1434] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/12

<199802100952.SAA04346@eban.ase.ptg.sony.co.jp> の、

[#1435] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/12

わたなべです.

[#1436] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/12

<199802120449.NAA00398@eban.ase.ptg.sony.co.jp> の、

[ruby-dev:1397] Tk.mainloopと Thread

From: Masao Kanemitsu <masao-k@...>
Date: 1998-02-06 06:19:44 UTC
List: ruby-dev #1397
サンプルの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
−−−

In This Thread

Prev Next