Fixed header and footer with ncurses?

This is the first time I am running ncurses (via UniCurses for Python). I am trying to create a console application with a fixed header and footer, but the documentation is not clear how I will do this. Would I use a window? Panel? Something other? I figured out how to provide a line of text that it owns foreground and background colors, but I don’t know how to extend it for the entire length of the console window. To understand what I'm trying to do, look at these cmus screenshots:

http://cmus.sourceforge.net/#home

The blue header at the top and the blue and white footer at the bottom are what I'm trying to get to. Thank!

+3
source share
2 answers

Ok, got it. Auxiliary windows for rescue:

init_pair(1, COLOR_BLACK, COLOR_WHITE)
header = subwin(stdscr, 1, 80, 0, 0)

wattron(header, COLOR_PAIR(1))
waddstr(header, "Title")
wbkgd(header, COLOR_PAIR(1))
wattroff(header, COLOR_PAIR(1))

, .

+2

Python Curses Module

from curses import *
stdscr = initscr()
start_color()
init_pair(1,COLOR_RED,COLOR_WHITE)

max_y, max_x = stdscr.getmaxyx()

header = stdscr.subwin(1, max_x, 0, 0)

header.bkgd(color_pair(1))

wtv ,

header.addstr('Header Text')

header.refresh()
+1

All Articles