In the case of dynamic printouts / displays, I would suggest using IPython's display module.
Note: I've edited my answer (after seeing many of the responses here) to allow for terminal as well as notebook display choices...
# Create your figures
fig_1 = """
_
|_|
-|-
|
/\\
"""
fig_2 = """
_
|_|
-|/
|
/\\
"""
# Now the code / display
from IPython.display import display, clear_output
import time
import os
notebook = False
display(fig_1)
time.sleep(.1)
if notebook: clear_output(wait=True)
else: os.system('clear')
display(fig_2)
A fancier way of doing this:
# A fancier way of doing it
def display_animated_figs(all_figs:list, sleep_s:float, notebook=False):
"""Displays each figure in the list of figs,
while waiting between to give `animated feel`
notebook: (bool) are you operating in a notebook? (True) Terminal? (False)
"""
for i, fig in enumerate(all_figs):
# Always clear at start...
# Allow for notebooks or terminal
if notebook:
clear_output(wait=True)
else:
os.system('clear')
# After the first figure, wait
if i>0:
time.sleep(sleep_s)
display(fig)
# All done, nothing to return
# Now execute
my_figs = [fig_1, fig_2]
display_animated_figs(my_figs, 0.1, False)