finished python version of scanw_example (7.4)
This commit is contained in:
parent
791b8d227c
commit
579ad3c15e
24
basics/scanw_example.py
Normal file
24
basics/scanw_example.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user