-
Notifications
You must be signed in to change notification settings - Fork 0
/
spinner.py
50 lines (43 loc) · 1.15 KB
/
spinner.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
47
48
49
50
import itertools
import threading
import time
import sys
from logo_maker import *
from slowprint import slowprint
def spin_loader():
green_color()
done = False
#here is the animation
def spinner():
for c in itertools.cycle(['|', '/', '-', '\\']):
if done:
break
sys.stdout.write('\rInitializing UI... ' + c)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write('')
t = threading.Thread(target=spinner)
t.start()
#long process here
time.sleep(8)
done = True
white_color()
def spin_loader_probe():
green_color()
done = False
#here is the animation
def spinner():
slowprint('Launching probe..!')
for c in itertools.cycle(['|', '/', '-', '\\']):
if done:
break
sys.stdout.write('\rWaiting for connection... ' + c)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write('')
t = threading.Thread(target=spinner)
t.start()
#long process here
time.sleep(8)
done = True
white_color()