PyGame удаление созданной фигуры
хочу сделать при клике на кружочек он исчезал но не исчезает.
import pygame
from random import randint
WIDTH = 1280
HEIGHT = 720
FPS = 30
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
def main():
circles = []
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Training Reaction")
clock = pygame.time.Clock()
running = True
click_rect = pygame.Rect(WIDTH//3, HEIGHT//3, WIDTH//3, HEIGHT//3)
screen.fill(BLACK)
pygame.display.flip()
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_ARROW)
screen.lock()
for x in range(0, 10):
randomX = randint(50, WIDTH-50)
randomY = randint(50, HEIGHT-50)
circles.append(pygame.draw.circle(screen, WHITE, (randomX, randomY), 15))
pygame.display.update()
screen.unlock()
while running:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONUP:
if click_rect.collidepoint(event.pos):
for x in circles:
circles.remove(x)
pygame.quit()
if __name__ == '__main__':
main()