import curses

text = [
    "a very simple curses demo",
    "",
    "(press any key to exit)"
]

# connect to the screen
screen = curses.initscr()

# setup keyboard
curses.noecho() # no keyboard echo
curses.cbreak() # don't wait for newline

# screen size
rows, columns = screen.getmaxyx()

# draw a border around the screen
screen.border()

# display centered text
y = (rows - len(text)) / 2

for line in text:
    screen.addstr(y, (columns-len(line))/2, line)
    y = y + 1

screen.getch()

curses.endwin()

a3cb7731051b11e0ca619a94849b1f87afff3044
<mask token>

<mask token>
curses.noecho()
curses.cbreak()
<mask token>
screen.border()
<mask token>
for line in text:
    screen.addstr(y, (columns - len(line)) / 2, line)
    y = y + 1
screen.getch()
curses.endwin()

<mask token>
text = ['a very simple curses demo', '', '(press any key to exit)']
screen = curses.initscr()
curses.noecho()
curses.cbreak()
rows, columns = screen.getmaxyx()
screen.border()
y = (rows - len(text)) / 2
for line in text:
    screen.addstr(y, (columns - len(line)) / 2, line)
    y = y + 1
screen.getch()
curses.endwin()

import curses
text = ['a very simple curses demo', '', '(press any key to exit)']
screen = curses.initscr()
curses.noecho()
curses.cbreak()
rows, columns = screen.getmaxyx()
screen.border()
y = (rows - len(text)) / 2
for line in text:
    screen.addstr(y, (columns - len(line)) / 2, line)
    y = y + 1
screen.getch()
curses.endwin()

import curses

text = [
    "a very simple curses demo",
    "",
    "(press any key to exit)"
]

# connect to the screen
screen = curses.initscr()

# setup keyboard
curses.noecho() # no keyboard echo
curses.cbreak() # don't wait for newline

# screen size
rows, columns = screen.getmaxyx()

# draw a border around the screen
screen.border()

# display centered text
y = (rows - len(text)) / 2

for line in text:
    screen.addstr(y, (columns-len(line))/2, line)
    y = y + 1

screen.getch()

curses.endwin()
