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.
26 lines
608 B
26 lines
608 B
15 years ago
|
import sys
|
||
|
import curses
|
||
|
|
||
|
|
||
|
def printw_example(stdscr):
|
||
|
mesg = "Just a string"
|
||
|
row, col = stdscr.getmaxyx()
|
||
|
stdscr.addstr(row / 2, (col - len(mesg)) / 2, mesg)
|
||
|
stdscr.addstr(row - 2, 0, "This screen has {0} rows and {1} "
|
||
|
"columns\n".format(row, col))
|
||
|
stdscr.addstr(row - 1, 0, "Try resizing your window (if possible) and then"
|
||
|
"run this program again")
|
||
|
stdscr.refresh()
|
||
|
stdscr.getch()
|
||
|
|
||
|
|
||
|
def main():
|
||
|
curses.wrapper(printw_example)
|
||
|
return 0
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
sys.exit(main())
|
||
|
|
||
|
# vim:filetype=python
|