not quite fully functional python version of "with_chgat"
This commit is contained in:
parent
996ade6414
commit
256a92a41d
@ -1,24 +1,15 @@
|
|||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
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);
|
init_pair(1, COLOR_CYAN, COLOR_BLACK);
|
||||||
printw("A Big string which i didn't care to type fully ");
|
printw("A Big string which i didn't care to type fully ");
|
||||||
mvchgat(0, 0, -1, A_BLINK, 1, NULL);
|
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();
|
refresh();
|
||||||
getch();
|
getch();
|
||||||
endwin(); /* End curses mode */
|
endwin();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
22
basics/with_chgat.py
Normal file
22
basics/with_chgat.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user