Created
February 14, 2021 14:29
-
-
Save illume/b4681bb4adfd95355a70eb5e8fb4bb52 to your computer and use it in GitHub Desktop.
press g key, see key repeat is slow. Press f key, then pressing g key means the key repeat is fast (broken).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Manual test for pygame #2100 | |
Press F to quit and restart the screen | |
""" | |
import pygame | |
#pygame.init() # <- problem doesn't happen at all with this | |
screen = pygame.display.set_mode([500, 500]) | |
clock = pygame.time.Clock() | |
pygame.key.set_repeat(500,500) | |
while True: | |
screen.fill((255,0,255)) | |
pygame.display.flip() | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
pygame.quit() | |
raise SystemExit | |
if event.type == pygame.KEYDOWN: | |
print(event) | |
if event.key == pygame.K_f: | |
pygame.display.quit() # <- works fine without this line | |
screen = pygame.display.set_mode([500, 500]) | |
# pygame.key.set_repeat(500,500) <- no impact on result for pygame 2 - necessary to pygame 1 | |
if event.key == pygame.K_g: | |
print(pygame.key.get_repeat()) # still returns (500, 500) after quit and init | |
clock.tick(60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment