Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the cursor in ncurses?

Tags:

ncurses

I am writing ncurses programs in C and C++. I have not found a way to conceal the cursor to the user. I have looked around on the internet a bit, but most of the information that I have found either concerns Python/Ruby implementations of (n)curses or doesn't actually concern the hiding of the cursor. How may I accomplish my goal?

like image 458
fouric Avatar asked Sep 16 '13 21:09

fouric


People also ask

How do you move the cursor in ncurses?

In ncurses, a screen is described by x, y coordinated graph in the ncurses, and by default cursor is at (0, 0) or the top left corner. To move cursor you should use move(int y, int x); function declared in ncurses.

How do I hide the cursor in Python?

Just use print('\033[? 25l', end="") to hide the cursor. You can show it back with print('\033[? 25h', end="") .


1 Answers

You need curs_set(0)

To quote the man page:

The curs_set routine sets the cursor state to invisible, normal, or very visible for visibility equal to 0, 1, or 2 respectively. If the terminal supports the visibility requested, the previous cursor state is returned; otherwise, ERR is returned.

like image 151
parkydr Avatar answered Sep 21 '22 13:09

parkydr