not quite fully functional python version of "with_chgat"

This commit is contained in:
Dan Buch 2009-11-23 08:40:07 -05:00
parent 996ade6414
commit 256a92a41d
2 changed files with 27 additions and 14 deletions

View File

@ -1,24 +1,15 @@
#include <ncurses.h>
int main(int argc, char *argv[])
{ initscr(); /* Start curses mode */
start_color(); /* Start color functionality */
{
initscr();
start_color();
init_pair(1, COLOR_CYAN, COLOR_BLACK);
printw("A Big string which i didn't care to type fully ");
mvchgat(0, 0, -1, A_BLINK, 1, NULL);
/*
* First two parameters specify the position at which to start
* Third parameter number of characters to update. -1 means till
* end of line
* Forth parameter is the normal attribute you wanted to give
* to the charcter
* Fifth is the color index. It is the index given during init_pair()
* use 0 if you didn't want color
* Sixth one is always NULL
*/
refresh();
getch();
endwin(); /* End curses mode */
getch();
endwin();
return 0;
}

22
basics/with_chgat.py Normal file
View File

@ -0,0 +1,22 @@
import sys
import curses
def with_chgat(stdscr):
curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
stdscr.addstr("A Big string which i didn't care to type fully ",
curses.color_pair(1))
# stdscr.chgat(0, 0, -1, curses.A_BLINK)
stdscr.refresh()
stdscr.getch()
def main():
curses.wrapper(with_chgat)
return 0
if __name__ == '__main__':
sys.exit(main())
# vim:filetype=python