+ 1
ASCII animation with python
I'm trying to do a multi-line ascii animation in Python 3. As I understand it, sys.stdout.write("\r"*(some_number)) will at most take me to the beginning of the current line. Can I also go back multiple lines? Example: I want a flashing x-o pattern (alternating) so I need to go back 5 lines: xx xx xx xx xx xx xx xx xx ooo oo oo oo oo oo oo ooo
5 Answers
+ 5
import os
os.system('clear') #Linux
os.system('CLS') #Windows
+ 4
And you can use asciimatics https://pypi.org/project/asciimatics/
+ 1
Which package is "clear" in?
0
why not store that data in a multiline string?
X = """XX XX
XX XX
XX
XX XX
XX XX"""
O = """ ooo
o o
o o
ooo"""
then use a combination of delay and the "clear" command to change between X and O