Skip to content

Instantly share code, notes, and snippets.

@SeryiBaran
Last active August 8, 2021 13:40
Show Gist options
  • Save SeryiBaran/f0cc1e128d35d8e0964723de95d8b75c to your computer and use it in GitHub Desktop.
Save SeryiBaran/f0cc1e128d35d8e0964723de95d8b75c to your computer and use it in GitHub Desktop.
Python Таймер
import time
import pygame
import os
pygame.mixer.init()
song = pygame.mixer.Sound("file.mp3")
seconds = int(input("Сколько секунд ждать: "))
for i in range(1, seconds+1):
time.sleep(1)
os.system("cls")
print("Таймер поставлен на", seconds)
print("Прошло", i)
print("Осталось", seconds - i)
print("\n")
clock = pygame.time.Clock()
song.play(-1)
while True:
clock.tick(60)
pygame.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment