Hidetoshi NAGAI wrote:

> How about the following?
> ----------------------------------------------------------------
> require 'tk'
> 
> evloop = Thread.new{Tk.mainloop}
> text = TkText.new(Tk.root).pack
> 
> i = 0
> n = 10000
> 
> Tk.root.protocol(:WM_DELETE_WINDOW){
>   if Tk.messageBox(:type=>'okcancel', :message=>' Realy? ') == 'ok'
>     printf "Bye ...\n"
>     exit
>   else
>     #ignore
>   end
> }
> 
> while (text.exist? rescue false)
>   if (i += 1) % n == 0
>     text.value = <<EOS
> This is GUI #{(i / n)}
> Time is #{Time.now.strftime("%Y-%m-%d %I:%M:%S")}
> EOS
>     printf "This is command line #{i / n}\n"
>   end
> end

That's looking great.  I don't know why but the line

  while (text.exist? rescue false)

is not getting through (the text.exist? won't be true).

right now i tweak a little bit of it and just make it

  while (1)

and still tweaking it.


-- 
Posted via http://www.ruby-forum.com/.