Python program to hide the mouse cursor on the Terminal screen
Write a program to hide the mouse cursor on the terminal screen.
Approach:
- The curses package is imported and used for this task in C language, napms function call is used for the delay, and curs_set() function is called to make the cursor disappear.
- In Python, a package called UniCurses, which is similar to the curses package, is imported and used. In the program, the sleep() function is used for the delay and the curs_set() function is called to make the cursor disappear and then appear again.
Below is the implementation of the above approach:
Python3
# Python program for the above approachimport cursesimport time # Initializing curses stdscr = curses.initscr() # Setting the cursor to visible by # inserting 1 as argumentcurses.curs_set(1) # Delay of 2 secondstime.sleep(2) # Setting the cursor to invisible by # inserting 0 as argumentcurses.curs_set(0) # Delay of 2 secondstime.sleep(2) # Setting the cursor to visible by # inserting 1 as argumentcurses.curs_set(1) # Delay of 2 secondstime.sleep(2) # Restoring terminal to it's# original statecurses.endwin() |
Output:
After running the program, a new window appears:
After 2 seconds, the mouse cursor disappears:



