What you are looking for can be found in the curses module.
i.e.
import curses
Important Note
It is important to remember that before any exit you need to reset the terminal to normal mode, this can be done with the following lines:
curses.nocbreak() stdscr.keypad(0) curses.echo() curses.endwin()
If you do not, you will get all the strange behavior. To always do this, I would suggest using the atexit module, for example:
import atexit @atexit.register def goodbye(): """ Reset terminal from curses mode on exit """ curses.nocbreak() if stdscr: stdscr.keypad(0) curses.echo() curses.endwin()
Most likely it will be good.
Steve Barnes Sep 21 '13 at 20:23 2013-09-21 20:23
source share