allow quit by pressing esc
This commit is contained in:
parent
cff537373e
commit
352e039e44
@ -12,7 +12,7 @@ def rainbow_spectrum(position):
|
|||||||
def main():
|
def main():
|
||||||
pygame.init()
|
pygame.init()
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
window = pygame.display.set_mode((720, 720))
|
window = pygame.display.set_mode((720, 720), pygame.FULLSCREEN)
|
||||||
rainbow_pos = 0
|
rainbow_pos = 0
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
@ -22,6 +22,9 @@ def main():
|
|||||||
for keyboard_event in pygame.event.get():
|
for keyboard_event in pygame.event.get():
|
||||||
if keyboard_event.type == pygame.QUIT:
|
if keyboard_event.type == pygame.QUIT:
|
||||||
running = False
|
running = False
|
||||||
|
if keyboard_event.type == pygame.KEYDOWN:
|
||||||
|
if keyboard_event.key == pygame.K_ESCAPE:
|
||||||
|
running = False
|
||||||
|
|
||||||
rainbow_pos %= 1530
|
rainbow_pos %= 1530
|
||||||
window.fill(rainbow_spectrum(rainbow_pos))
|
window.fill(rainbow_spectrum(rainbow_pos))
|
||||||
|
Loading…
Reference in New Issue
Block a user