-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload.py
More file actions
56 lines (50 loc) · 1.4 KB
/
Copy pathload.py
File metadata and controls
56 lines (50 loc) · 1.4 KB
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
51
52
53
54
55
56
import threading
from time import sleep,time
from localization import t
loading=False
startTime=0
l=[
'[-> ]',
'[--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--> ]',
'[ <--]',
'[ <-]',]
l+=l[::-1]
from colorama import Fore
def load(color,text):
l2=['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
index=0
global l
while loading:
for i in l:
print(color+l2[index%10]+i+'\t'+text+Fore.RESET,end='\r')
index+=1
sleep(0.1)
if not loading:
break
def startLoading(color,text):
global loading,startTime
startTime=time()
loading=True
thread=threading.Thread(target=load,args=(color,text))
thread.start()
def stopLoading():
global loading,startTime
loading=False
print(f'\n{t("default.loading.elapsed")}:{time()-startTime:.2f}s')
print('\n')
if __name__=='__main__':
startLoading('',t("loading.text"))
sleep(12)
stopLoading()