Python program to hide the mouse cursor on the Terminal screen
Last Updated :
18 Aug, 2020
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
import curses
import time
stdscr = curses.initscr()
curses.curs_set( 1 )
time.sleep( 2 )
curses.curs_set( 0 )
time.sleep( 2 )
curses.curs_set( 1 )
time.sleep( 2 )
curses.endwin()
|
Output:
After running the program, a new window appears:
After 2 seconds, the mouse cursor disappears:
After 4 seconds, the mouse cursor appears again:
After 6 seconds, the program ends:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...