from halo import Halo spinner = Halo(text='Loading') spinner.start() # do some work here spinner.stop()
from halo import Halo spinner = Halo(text='Loading') spinner.start() for i in range(10): # do some work here spinner.text = f'Loading {i+1}/10' spinner.stop()This code creates a spinner with the text 'Loading', starts it spinning, and then updates the text with a progress indicator as the work is done. In both cases, the Halo package library is being used to create and control the spinner.