From: Noritugu Nakamura Date: 1997-01-26T05:57:30+09:00 Subject: [ruby-list:1875] toplevel of Tk 中村です。 まだまだ分からないことが たくさんあるので教えてください。 今回は toplevel の使い方についてです。 たとえば以下のプログラムと同じものを 作るにはどうしたらいいのでしょうか? ruby/Tk の途中まで書いたものもつけておきます。 #!/usr/local/X11R6/bin/wish4.2 proc new_win {} { catch {destroy .w} toplevel .w button .w.b -text "Dismiss" -command {destroy .w} pack .w.b } button .button -text "New Window" -command {new_win} pack .button -fill x button .quit -text "Quit" -command exit pack .quit -fill x #!/usr/local/bin/ruby require "tk" $root = Tk.root def new_win # ここに toplevel ? TkButton.new { text 'Dismiss' # command {destroy .w} pack } end TkButton.new { text 'New Window' command "new_win" pack('fill' => 'x') } TkButton.new { text 'Quit' command 'exit' pack('fill' => 'x') } Tk.mainloop よろしくお願い致します。 中村典嗣@京都大学大学院工学研究科電子通信工学専攻 E-mail: nnakamur@tamaru.kuee.kyoto-u.ac.jp