-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
61 lines (51 loc) · 1.39 KB
/
main.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
51
52
53
54
55
56
57
58
59
60
61
import planet
import time
def clear_screen():
'''
Clears the screen
'''
print('\033[2J')
def move_cursor(right=0, left=0, up=0, down=0):
'''
Moves the cursor in a given direction
'''
if up: print(f'\u001b[{up}A')
elif down: print(f'\u001b[{right}B')
elif right: print(f'\u001b[{right}C')
elif left: print(f'\u001b[{left}D')
def print_colored(color: str, string: str, **kargs):
'''
Prints color text
Colors: black, red, green, yellow, blue, dark blue, white, purple
'''
colors = {'black': '30',
'red': '31',
'green': '32',
'yellow': '33',
'dark blue': '34',
'purple': '35',
'blue': '36',
'white': '37',
'reset': '0'
}
print(f'\u001b[{colors[color]}m', **kargs)
print(string, **kargs)
print(f"\u001b[{colors['reset']}m", **kargs)
def main():
color = 'yellow'
wait_str = 'Getting information from satellites '
clear_screen()
print('\n', wait_str, end='', sep='')
for i in range(15):
time.sleep(0.25)
print('.', end='', flush=True)
for frame in planet.frames:
clear_screen()
print_colored(color, frame, end='')
time.sleep(1)
move_cursor(up=26)
else:
clear_screen()
print('THE END')
if __name__ == '__main__':
main()