Skip to content

Instantly share code, notes, and snippets.

@Y4suyuki
Created October 3, 2013 06:22
Show Gist options
  • Select an option

  • Save Y4suyuki/6805818 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

ghost commented Apr 18, 2018

i like it

@SonnyAzIgazi
Copy link
Copy Markdown

<3

@sabelomaga
Copy link
Copy Markdown

Nice!

@PiepsC
Copy link
Copy Markdown

PiepsC commented Mar 16, 2019

Nice little trick there

@leo-smi
Copy link
Copy Markdown

leo-smi commented Aug 31, 2019

Doesn't work in IDLE but, thnx

@NeelRoshania
Copy link
Copy Markdown

Thank you!

@armanbayona
Copy link
Copy Markdown

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
Copy Markdown

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