0

I'm trying to print out the last line of code on a separate line, as it always prints on the same line as the spinner?

I've already tried removing the sleep function.

from halo import Halo
import time
from colorama import Fore

name = input("TARGET:\n")

spinner = Halo(text='\nCalling: ' + name, spinner='dots')

spinner.start('\rCalling: ' + name)

time.sleep(5)

print(Fore.GREEN + 'Call Successful! [Internet = POSITIVE]')

I expect the output of the last line to be on a separate line when printed.

Simon Notley
  • 2,070
  • 3
  • 12
  • 18
JipBit
  • 31
  • 5
  • 2
    Does stopping the spinner first work? Or possibly adding \n at the start of your print. – Simon Notley Nov 03 '19 at 14:03
  • I just had to stop the spinner, thank you! Also, I know this is a separate question, but how would can I clear an output in the terminal after it's been printed? – JipBit Nov 03 '19 at 20:34
  • So that I can clear the target input and output above, and only have the final message in the console after the spinner stops. – JipBit Nov 03 '19 at 20:39

1 Answers1

0

Two options for you. On my system (Mac) your code doesn't seem to do what it's supposed to, it just prints loads of lines rather than a spinner. In any case here are options that I would expect to work:

Stop the spinner

name = input("TARGET:\n")

spinner = Halo(text='\nCalling: ' + name, spinner='dots')

spinner.start('\rCalling: ' + name)

time.sleep(5)

spinner.stop()

print(Fore.GREEN + 'Call Successful! [Internet = POSITIVE]')

Add a newline

name = input("TARGET:\n")

spinner = Halo(text='\nCalling: ' + name, spinner='dots')

spinner.start('\rCalling: ' + name)

time.sleep(5)

print("\n" + Fore.GREEN + 'Call Successful! [Internet = POSITIVE]')
Simon Notley
  • 2,070
  • 3
  • 12
  • 18