finished python version of scanw_example (7.4)

This commit is contained in:
Dan Buch 2009-11-21 11:04:40 -05:00
parent 791b8d227c
commit 579ad3c15e

24
basics/scanw_example.py Normal file
View File

@ -0,0 +1,24 @@
import sys
import curses
def scanw_example(stdscr):
mesg = 'Enter a string: '
row, col = stdscr.getmaxyx()
curses.echo()
stdscr.addstr(row / 2, (col - len(mesg)) / 2, mesg)
instr = stdscr.getstr()
stdscr.addstr(row - 2, 0, 'You Entered: {0}'.format(instr))
stdscr.getch()
def main():
curses.wrapper(scanw_example)
return 0
if __name__ == '__main__':
sys.exit(main())
# vim:filetype=python