-
-
Save zed/dcc6ae76487add302371 to your computer and use it in GitHub Desktop.
This file contains 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
import time | |
import pygame | |
pygame.init() | |
size = (700, 500) | |
screen = pygame.display.set_mode(size) | |
pygame.display.set_caption("444ms click") | |
done = False | |
clock = pygame.time.Clock() | |
# from http://soundbible.com/184-Button-Click-On.html | |
click = pygame.mixer.Sound("Button Click On-SoundBible.com-459633989.wav").play | |
TICK = pygame.USEREVENT + 1 | |
pygame.time.set_timer(TICK, 440) | |
timer = pygame.time.get_ticks | |
start = now = timer() | |
while not done: | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
done = True | |
if event.type == TICK: | |
now = timer() | |
print(now - start) | |
start = now | |
click() | |
clock.tick(60) | |
pygame.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment