[+] Catch ctrl+c
This commit is contained in:
parent
a437957702
commit
cdbf8a6b24
1 changed files with 10 additions and 4 deletions
|
@ -19,6 +19,8 @@ def start_animation():
|
||||||
text_height = len(text_lines)
|
text_height = len(text_lines)
|
||||||
text_width = len(text_lines[0])
|
text_width = len(text_lines[0])
|
||||||
|
|
||||||
|
notice = "Press enter to continue"
|
||||||
|
|
||||||
speed = 2
|
speed = 2
|
||||||
frame_delay = 1 / 25
|
frame_delay = 1 / 25
|
||||||
|
|
||||||
|
@ -83,12 +85,16 @@ def start_animation():
|
||||||
|
|
||||||
print(buf, end='', flush=True)
|
print(buf, end='', flush=True)
|
||||||
|
|
||||||
while 1:
|
try:
|
||||||
|
while 1:
|
||||||
|
# Clear the screen
|
||||||
|
print("\033[2J\033[H", end="")
|
||||||
|
draw_frame()
|
||||||
|
frame += speed
|
||||||
|
sleep(frame_delay)
|
||||||
|
except KeyboardInterrupt:
|
||||||
# Clear the screen
|
# Clear the screen
|
||||||
print("\033[2J\033[H", end="")
|
print("\033[2J\033[H", end="")
|
||||||
draw_frame()
|
|
||||||
frame += speed
|
|
||||||
sleep(frame_delay)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue