Как изменить цвет квадрата в пигаме с помощью keypress
circlerect = pygame.draw.circle(SCREEN, COLOR, POS, RADIUS)
pygame.display.update(circlerect)
Vivacious Vicuña
circlerect = pygame.draw.circle(SCREEN, COLOR, POS, RADIUS)
pygame.display.update(circlerect)
while True:
for events in pygame.event.get():
if events.type == pygame.QUIT:
pygame.quit()
sys.exit()
#Here for any commands inside the for loop
if (events.type == pygame.KEYDOWN) and (events.key == pygame.K_SPACE):
COLOR = (random.randint(ZEROINTENSITY, MAXINTENSITY), random.randint(ZEROINTENSITY, MAXINTENSITY), random.randint(ZEROINTENSITY, MAXINTENSITY))
#note- we have skipped the last parameter and by default, 0 is taken
pygame.draw.circle(SCREEN, COLOR, POS, RADIUS)
pygame.display.update()