curses bkgd problem

Gandalf gandalf at geochemsource.com
Tue Mar 9 03:03:27 EST 2004



Gandalf wrote:

> stdscr = curses.initscr() # Get standard screen
> curses.start_color()      # Uses colors
> stdscr.bkgd(' ',curses.COLOR_BLUE ) # Set background of the main window
> curses.noecho()           # Do not echo input
> curses.cbreak()           # CBreak mode: process keys immediately (no 
> ENTER)
> stdscr.keypad(1)          # keypad mode: parse control sequences
> stdscr.redrawwin()
> stdscr.refresh()
>
> However, it is displaying $ characters in black instead of displaying 
> a blue background full of spaces.
> This must be a problem with my bkgd call since this works fine:
>
> curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
> stdscr.addstr(0, 0, curses.longname(), curses.color_pair(1) )
> stdscr.refresh()
>
Now I'm doing this:

def clrscr():
    global stdscr
    (maxy,maxx) = stdscr.getmaxyx()
    line = ' ' * (maxx-1)
    for row in range(maxy):
        stdscr.addstr(row, 0, line, curses.color_pair(1) )

which works fine except that the right side of the screen is still black.
It is a very clumsy solution. Any ideas?

  G






More information about the Python-list mailing list