Links: PYTHON - PROGRAMMING
Rel: python standard library
Ref: https://docs.python.org/3/howto/curses.html
- https://docs.python.org/3/howto/curses.html#attributes-and-color
Tags: #public
import time
import curses
# standard init: {: id="standard-init:" }
stdscr = curses.initscr() # the screen {: id="the-screen" }
curses.curs_set(0)
curses.noecho()
curses.cbreak()
stdscr.keypad(True)
stdscr.addstr(15,5, "Hello")
stdscr.refresh()
time.sleep(3)
# standard breakdown: {: id="standard-breakdown:" }
curses.curs_set(1)
curses.echo()
curses.nocbreak()
stdscr.keypad(False)
curses.endwin()
# ^^ must breakdown what you init, {: id="^^-must-breakdown-what-you-init," }
# or end up with stuff remaining in terminal {: id="or-end-up-with-stuff-remaining-in-terminal" }
# exit... {: id="exit..." }
# or, the true standard: {: id="or,-the-true-standard:" }
# curses.wrapper(func) {: id="curses.wrapper(func)" }
def main(stdscr):
curses.curs_set(0)
stdscr.addstr(15,5, "Hello")
time.sleep(3)
curses.wrapper(main)