Yeah I tried with this clear method, with the unsafe system(‘cls’)
however, but if i clear and redraw every second, it flickers very much.
Using “cls” had also occurred to me, but I (literally) see
what you mean about the flickering:
50.times do | k | k = k.to_s
system( “cls” )
30.times do | n | n = ’ *’ + k + ‘=’ + n.to_s
puts n * 10
Not very pleasant visually, and it looks as though it would be
very difficult to actually see any information properly.
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.
That suggests to me that you’ve tried using “curses”
on Win32 and Linux and that it didn’t do what you wanted.
Is that right?
I’m gettting the distinct impression that you and Shot
know a lot more about this than I do, which makes me
a bit reluctant to post the code below, because I suspect
you may have already tried something like it,
and it didn’t do what you want.
But since it’s something which I might use in the future,
I’ll post it, because that will fix it more firmly in my mind.
(And now I really know why GNU wget uses a single line
progress bar: it’s simpler just to use print 13.chr + “text”.)
(Assuming this doesn’t do what you want on Linux (or Win32),
I’d be interested in a few details of what problems you’ve
found trying to get something to work on both Win32 and Linux.)
This is based on the “hello.rb” example in the following place
on my Win32 Ruby installation:
puts ‘##### screen size(?): lines, cols:’, lines, cols
puts ‘about to display text’
setpos( 8, 13 )
addstr(“display text which we will partly over-write later”)
setpos( 3, 40 ) ; addstr(“display some text”) ; refresh
setpos( 8, 40 ) ; addstr(“PARTLY”) ; refresh
setpos( 8, 32 ) ; addstr(“W”) ; refresh
20000.times do | k |
setpos( 8, 13 ) ; addstr( k.to_s + " ") ; refresh
This seems to work reasonably fast on Win32.
(And it reminds me that I did once know something about
moving stuff about on screens using DOS: in the 1980s
I got so fed up with reinventing wheels every time
I wanted input in BASIC programs that I wrote
a parameter file driven program to generate input screens.
Somewhat to my surprise, it worked quite well!)