Reputation: 53
The way I usually edit the terminal is by writing:
Import os
While "something":
"Do something"
Lambda: os.system("cls")
print("result")
For clarification, I don't want to clear the console, I want to edit it directly so I can make a similar effect to the spinning line ('|','/','-','|','-','\')
.
Upvotes: 1
Views: 476
Reputation: 211
sys.stdout.write('\b ')
will move the cursor back and replace the text with an empty space.
Upvotes: 1
Reputation: 2017
The short answer - it's not possible due to the nature of how text console works. It always prints text. If you need to have a static text and an ability to edit it, you have to keep initial text in memory, edit it and re-print it again by clearing previous text on the screen.
Upvotes: 1