Skip to content

Instantly share code, notes, and snippets.

@Y4suyuki
Created October 3, 2013 06:22
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Y4suyuki/6805818 to your computer and use it in GitHub Desktop.
Save Y4suyuki/6805818 to your computer and use it in GitHub Desktop.
python script which print animation on console
import time
import sys
animation = "|/-\\"
for i in range(100):
time.sleep(0.1)
sys.stdout.write("\r" + animation[i % len(animation)])
sys.stdout.flush()
print "End!"
Copy link

ghost commented Apr 18, 2018

i like it

@SonnyAzIgazi
Copy link

<3

@sabelomaga
Copy link

Nice!

@PiepsC
Copy link

PiepsC commented Mar 16, 2019

Nice little trick there

@leo-smi
Copy link

leo-smi commented Aug 31, 2019

Doesn't work in IDLE but, thnx

@NeelRoshania
Copy link

Thank you!

@armanbayona
Copy link

armanbayona commented Oct 25, 2019

#heres mine
import time, sys, os

os.system("clear")

b0 = "- "
b1 = " - "
b2 = " - "
b3 = " - "
b4 = " - "
b5 = " - "
b6 = " - "
b7 = " - "
b8 = " - "
b9 = " - "
e = "˚˚˚˚˚˚˚˚˚˚TTTTTTT"
m = "▽▽▽▽▽▽▽▽▽▽_______"

for i in range(15):
time.sleep(0.1)
sys.stdout.write(
"\r (•◡•)⌐╦╦═─"
+ b0[i % len(b0)]
+ b1[i % len(b0)]
+ b2[i % len(b0)]
+ b3[i % len(b0)]
+ b4[i % len(b0)]
+ b5[i % len(b0)]
+ b6[i % len(b0)]
+ b7[i % len(b0)]
+ b8[i % len(b0)]
+ b9[i % len(b0)]
+ "("
+ e[i % len(e)]
+ m[i % len(e)]
+ e[i % len(e)]
+ ")"
)
sys.stdout.flush()
print("\n" + "You Died!".center(30, " "))

@GuySky
Copy link

GuySky commented Feb 26, 2023

Thanks! Was really helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment