Year of the Fire Tiger

No, not the game or Beyonce song…

Today’s post is an exercise for the reader, as I’ve got to go meet my Viet sister soon to exercise. I found this libarary called “Halo”, that makes activity spinners for CLI tools. This was the ⚡️Talk I gave Monday. So, create a virtual environment (I should write a post on dependency management), then pip install halo and try the code below. I’ll explain it tomorrow or later this week. Lines 7 & 10 determine how long it runs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from halo import Halo # pip install halo first
import time
 
spinner = Halo({'text': 'Calculating...',  'color': 'red','spinner': 'dots8'})
spinner.start()
counter = 0
while counter < 51:
                # print(counter)
                counter += 1
                time.sleep(.1)
# Run time consuming work here
# You can also change properties for spinner as and when you want
 
# spinner.stop()
spinner.succeed()