25 lines
437 B
Python
25 lines
437 B
Python
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
|