Mouseclick does now also take pictures

This commit is contained in:
Balthasar Reuter
2015-05-27 23:45:08 +02:00
parent d54d189c45
commit 5dfdf367b8

View File

@@ -113,7 +113,7 @@ class GUI_PyGame:
def show_message(self, msg):
# Choose font
font = pygame.font.Font(None, 36)
font = pygame.font.Font(None, 48)
# Render text
text = font.render(msg, 1, (10, 10, 10))
# Position and display text
@@ -135,6 +135,7 @@ class GUI_PyGame:
# Handle the event
if event.type == pygame.QUIT: return
elif event.type == pygame.KEYDOWN: handle_keypress(event.key)
elif event.type == pygame.MOUSEBUTTONDOWN: handle_mousebutton(event.button, event.pos)
# Ignore all input that happened inbetween
pygame.event.clear()
@@ -216,6 +217,12 @@ def handle_keypress(key):
elif key == ord('c'):
take_picture()
def handle_mousebutton(key, pos):
"""Implements the actions for the different mousebutton events"""
# Take a picture
if key == 1:
take_picture()
def handle_gpio_event(channel):
"""Implements the actions taken for a GPIO event"""
if channel == gpio_trigger_channel: