[NEWBIE] Curses question

Andrew Kuchling akuchlin at mems-exchange.org
Tue Jul 11 12:37:04 EDT 2000


sill at localhost.kitenet.net (Oldayz) writes:
> #!/usr/bin/env python
> import curses
> stdscr = curses.initscr()
> stdscr.addstr(1, 1, 'Test.')

You need to call stdscr.refresh() to actually force output to the
screen.  curses works by keeping a copy of what the user's screen
looks like, and what the screen looks like as modified by the program;
.refresh() synchronizes the two. (This comes from curses's ancestry in
a world with limited-speed terminals.)

You probably also want the program to pause for a bit after updating
the screen; add stdscr.getch() to wait for a keystroke, or
a time.sleep() call to pause for some number of seconds.

--amk



More information about the Python-list mailing list