In comp.lang.python, Barry Scott <ba...@barrys-emacs.org> wrote: > Alan Gauld via Python-list <python-list@python.org> wrote: >> I've written a short program that is supposed to >> - *clear the screen*, >> - read some input >> - display the result in a message *highlighted in bold*. >> - get input to end the program > It seems that curses does not allow you to mix raw stdin/stdout with its > calls.
This sounds very plausable. In C, in curses one uses printw() not printf(). > If all you want is simple things like bold and clear I'd just use the > ANSI escape sequences directly. > > Are there any terminals that do not understand ANSI escape sequences > these days? Probably, I hear tales of people using odd set-ups from time to time. But that could just be the circles I hang out in. When I've wanted to do simple things like bold and clear, I've used the tput(1) tool. You can capture stdout from the tool and use the output over and over. Typically I've done this in shell scripts: #!/bin/sh bold=$(tput smso) # set mode stand out nobold=$(tput rmso) # remove mode stand out clear=$(tput clear) # clear screen home=$(tput home) # home, without clear for word in Ten Nine Eight Seven Six Five Four Three Two One; do echo "${clear}${bold}${word}${nobold} ..." sleep 1 done echo "${home}Nothing happens." exit Elijah ------ adapting to python left as an excercise for the reader -- https://mail.python.org/mailman/listinfo/python-list