From b375c12f6947c7a903ad067952e62a041ca769b4 Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Fri, 11 Jun 2021 13:44:01 +0300 Subject: [PATCH] 1 --- OfficialProjects/SuperTimer/SuperTimer.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 OfficialProjects/SuperTimer/SuperTimer.py diff --git a/OfficialProjects/SuperTimer/SuperTimer.py b/OfficialProjects/SuperTimer/SuperTimer.py new file mode 100644 index 0000000..5ddd726 --- /dev/null +++ b/OfficialProjects/SuperTimer/SuperTimer.py @@ -0,0 +1,22 @@ +import time, subprocess, sys, os, urllib.request +try: + import datetime +except: + subprocess.check_call([sys.executable, "-m", "pip", "install", 'datetime']) + import datetime +try: + from playsound import playsound +except: + subprocess.check_call([sys.executable, "-m", "pip", "install", 'playsound']) + from playsound import playsound + +superSecond = float(input("Print how many real seconds will be in superSecond: ")) +timeInSuperSeconds = int(input("Timer in superSeconds: ")) + +os.system('cls' if os.name == 'nt' else 'clear') + +width = str(len(str(int(timeInSuperSeconds)))) +while timeInSuperSeconds > 0: + print('Time remaining: {{:{:}}} seconds'.format(width).format(timeInSuperSeconds), end='\r') + timeInSuperSeconds -= 1 + time.sleep(superSecond)