You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
box-o-sand/basics/scanw_example.py

25 lines
437 B

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