I tried using something like this but it did not work.
while running: keys = pygame.key.get_pressed() #checking pressed keys if keys[pygame.K_UP]: y1 -= 1 i
One solution to this problem would be to use set_repeat function
set_repeat
pygame.key.set_repeat(True)
This will generate multiple KEYDOWN events.
KEYDOWN