forked from ayushagarwal001/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
46 lines (42 loc) · 1.46 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import itertools
import threading
import time
import sys, os
loaded = False
loading_animations = [
'\u250F\u2513 \n\u2517\u251B \n\n\n\n',
' \u250F\u2513 \n \u2517\u251B \n\n\n\n',
' \u250F\u2513 \n \u2517\u251B \n\n\n\n',
' \u250F\u2513 \n \u2517\u251B \n\n\n\n',
' \u250F\u2513\n \u2517\u251B\n\n\n\n',
'\n \u250F\u2513\n \u2517\u251B\n\n\n',
'\n\n \u250F\u2513\n \u2517\u251B\n\n',
'\n\n\n \u250F\u2513\n \u2517\u251B\n',
'\n\n\n\n \u250F\u2513\n \u2517\u251B',
'\n\n\n\n \u250F\u2513 \n \u2517\u251B ',
'\n\n\n\n \u250F\u2513 \n \u2517\u251B ',
'\n\n\n\n \u250F\u2513 \n \u2517\u251B ',
'\n\n\n\n\u250F\u2513 \n\u2517\u251B ',
'\n\n\n\u250F\u2513 \n\u2517\u251B \n',
'\n\n\u250F\u2513 \n\u2517\u251B \n\n',
'\n\u250F\u2513 \n\u2517\u251B \n\n\n'
]
def loading():
for c in itertools.cycle(loading_animations):
if loaded:
break
sys.stdout.write(c)
time.sleep(0.1)
for i in range(5):
sys.stdout.write("\033[F")
sys.stdout.flush()
os.system('clear')
print('Loading complete!')
os.system('clear')
t = threading.Thread(target=loading)
sys.stdout.write("\033[?25l")
t.start()
time.sleep(10)
loaded = True
t.join()
sys.stdout.write("\033[?25h")