how to set the background color of a window with curses

Marco Herrn herrn at gmx.net
Sat Mar 9 16:15:19 EST 2002


On Sat, Mar 09, 2002 at 05:42:04PM +0100, Gerhard Häring wrote:
> Le 09/03/02 à 13:53, Marco Herrn écrivit:
> > Hi,
> > 
> > I am trying to set a backround color for a window and did it with
> > 
> > stdscr.bkgd(' ', curses.COLOR_BLUE)
> > 
> > But that doesn't work. It seems to do nothing.
> > What am I doing wrong?
> 
> You're confusing colors with attributes. I recently stumbled across that
> one, too :)

Hmm, that may be true.... ;)

> This will do the trick:
> 
> # define color 1 as black on blue
> curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_BLUE)
> stdscr.bkgd(' ', curses.color_pair(1))

No, that doesn't work for me.
The whole screen remains black. I get no error message and any text that
is displayed with color_pair(1) is correctly displayed in black on blue.

Am I missing something else?

> Btw. there's a curses howto on http://py-howto.sf.net/ in case you
> didn't know.

Yes, I did read it. It is a good starting point, but unfortunately
doesn't go over my problem ;)


Bye
Marco
-- 
Experience is something you don't get until just after you need it.

--
Marco Herrn             herrn at gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736




More information about the Python-list mailing list