import pygame
import random
import math
import time
WIDTH = 500
HEIGHT = 500
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
running = True
pygame.time.set_timer(pygame.USEREVENT, 100)
counter=1
state = 0
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.USEREVENT:
if counter == 100:
state = 1
counter = counter + 1
if state == 0:
screen.fill((255,255,255))
f1 = pygame.font.Font(None, 50)
text1 = f1.render("Прогресс "+str(counter)+" % ", True,(180, 0, 0))
screen.blit(text1, (100,50))
pygame.draw.rect(screen, (255, 0, 255), (100, 200, counter*2, 75))
pygame.display.flip()
pygame.quit()
|