From: Colin Bartlett Date: 2009-05-17T06:52:32+09:00 Subject: Re: Console output Assuming I understand correctly what you want to do, on a Windows system to show progress in a "console" box I just repeatedly use (every second): print 13.chr + "text to show progress" The short bit of code below demonstrates this. (I hope!) So you may not need to use ncurses/curses. (Although using those might make it easier to do more complicated things. I haven't used ncurses/curses.) I haven't tried this on Linux, but as the basic idea is to use "print" (to avoid a new-line) and "13.chr" (to return to the start of the line before displaying the new progress text) I hope it would also work in Linux. puts puts 'simple (Windows) example to show putting text on same console line' k = 13 k.times do | n | txt = 'count= ' + n.to_s print 13.chr + txt ## CR = CarriageReturn sleep 0.5 end puts ' *** final new line' puts If you - or anyone else - is interested in some more complicated code then I'd be happy to post it. (Basically I wrapped the "print 13.chr + txt" in an object which tested when the next display should be made, and which displayed the (formatted) time so far, and some other relevant information.) On 5/16/09, Mk 27 wrote: >> I have asked several people and I got the answer about using >> ncurses/curses, however I haven't found any that works both on win32 and >> linux, which I need. > > Totally new to ruby but from experience with C and perl I would say the > answer to this question is tough luck. You have to use an API (such as > ncurses); if you cannot get that to work satisfactorily you will have to > write seperate front-ends for each OS. > > If ruby/Tk is cross platform enough and it's possible you might as well > go the GUI route; dealing with Tk is not much more complex than curses. > A simple task like this one will be -- simple. > -- > Posted via http://www.ruby-forum.com/. > >