From 884af776fc852c92f1bb696ad7482c076805a323 Mon Sep 17 00:00:00 2001 From: Megamichi Date: Sat, 4 Nov 2023 22:36:22 +0100 Subject: [PATCH] Upload --- v1.py | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 v1.py diff --git a/v1.py b/v1.py new file mode 100644 index 0000000..beaaed9 --- /dev/null +++ b/v1.py @@ -0,0 +1,74 @@ +#!/usr/bin/python3 +import os +from pynput import keyboard +from time import sleep + +def clear(): + if os.name == "nt": + os.system("cls") + else: + os.system("clear") + +def on_press(key): + global running + if key == keyboard.Key.space: + running = False + + +def on_release(key): + global running + if key == keyboard.Key.esc: + # Stop listener + running = "finito" + +listener = keyboard.Listener( + on_press=on_press, + on_release=on_release) + +listener.start() + +tx, ty = os.get_terminal_size().columns, os.get_terminal_size().lines +txhalb = int(tx / 2) +wobble_speed = 0.01 +wobble_pos = 0 +wobble_way = "right" +running = True +while running == True: + wobl = "-"*(tx-wobble_pos-5) + wobr = "-"*wobble_pos + wobbl = f"{wobr}🐄️{wobl}" + print(" "*txhalb,"↓") + print(f"[{wobbl}]") + print(wobble_pos) + + if wobble_way == "right": + wobble_pos += 1 + else: + wobble_pos -= 1 + + if wobble_pos >= tx-1: + wobble_way = "left" + elif wobble_pos == 0: + wobble_way = "right" + + sleep(wobble_speed) + clear() + + if running == "finito": + exit() + +if wobble_pos > txhalb: + wobble_site = "left" +else: + wobble_site = "right" + +if wobble_site == "right": + points = wobble_pos +else: + points = tx-wobble_pos + +point_quote = points-tx/100 +for a in range(points*2): + print("-"*a+"🐄️",end="\r") + sleep(0.01) +print("\n",point_quote,"%") \ No newline at end of file