/usr/lib64/python2.7/Demo/curses
NameSizeModeActions
life.py73490755editdlrm
life.pyc67870644editdlrm
life.pyo67870644editdlrm
ncurses.py66480755editdlrm
ncurses.pyc58450644editdlrm
ncurses.pyo58450644editdlrm
rain.py24030755editdlrm
rain.pyc22950644editdlrm
rain.pyo22950644editdlrm
README8520644editdlrm
repeat.py15150755editdlrm
repeat.pyc14530644editdlrm
repeat.pyo14530644editdlrm
tclock.py33310755editdlrm
tclock.pyc36480644editdlrm
tclock.pyo36480644editdlrm
xmas.py254460644editdlrm
xmas.pyc198640644editdlrm
xmas.pyo198640644editdlrm
Edit: /usr/lib64/python2.7/Demo/curses/repeat.py (1515B)
#! /usr/bin/python2.7 """repeat This simple program repeatedly (at 1-second intervals) executes the shell command given on the command line and displays the output (or as much of it as fits on the screen). It uses curses to paint each new output on top of the old output, so that if nothing changes, the screen doesn't change. This is handy to watch for changes in e.g. a directory or process listing. To end, hit Control-C. """ # Author: Guido van Rossum # Disclaimer: there's a Linux program named 'watch' that does the same # thing. Honestly, I didn't know of its existence when I wrote this! # To do: add features until it has the same functionality as watch(1); # then compare code size and development time. import os import sys import time import curses def main(): if not sys.argv[1:]: print __doc__ sys.exit(0) cmd = " ".join(sys.argv[1:]) p = os.popen(cmd, "r") text = p.read() sts = p.close() if sts: print >>sys.stderr, "Exit code:", sts sys.exit(sts) w = curses.initscr() try: while True: w.erase() try: w.addstr(text) except curses.error: pass w.refresh() time.sleep(1) p = os.popen(cmd, "r") text = p.read() sts = p.close() if sts: print >>sys.stderr, "Exit code:", sts sys.exit(sts) finally: curses.endwin() main()