I'm trying to make an app where you enter in the minute value then a window appears and counts down from the amount of minutes you put in. The window opens and shows how many minutes you entered but it does not count down. I am new to python so if you can fix my problem please leave the modified code in your answer. Thanks.
import pygame
import time
import sys
pygame.init()
q = True
WIDTH = 800
HEIGHT = 600
clock = pygame.time.Clock()
myFont = pygame.font.SysFont("monospace", 35)
def countdown(t):
t *= 60
while t:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
min, sec = divmod(t, 60)
timer = '{:02d}:{:02d}'.format(min, sec)
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('PyTimerTwo, By: ChanceMeteor515')
screen.fill((0, 0, 0))
text = str(timer)
label = myFont.render(text, True, (255, 255, 255))
screen.blit(label, (WIDTH - 200, HEIGHT - 40))
pygame.display.update()
#
print("\nTime's Up")
time.sleep(5400)
t = input("Enter Time In Minutes:")
countdown(int(t))
while q:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_h:
pygame.mouse.set_visible(False)
elif event.key == pygame.K_ESCAPE:
sys.exit()
clock.tick(120)
pygame.display.update()