Search

Create a count down timer on terminal using curses library in python

We can use the following code to create a countdown timer of 10 seconds on the terminal. It uses the curses library in python to create the timer.

Note that to be able to run the code you will need to have curses library for python installed.

You can refer to the following site to learn the installation How To Install ncurses Library on a Linux



Save the code as timer.py . Execute the code in the terminal using the command


You should see an output that looks as shown below,with the count changing every second.







No comments:

Post a Comment