Mouseclick does now also take pictures
This commit is contained in:
@@ -113,7 +113,7 @@ class GUI_PyGame:
|
|||||||
|
|
||||||
def show_message(self, msg):
|
def show_message(self, msg):
|
||||||
# Choose font
|
# Choose font
|
||||||
font = pygame.font.Font(None, 36)
|
font = pygame.font.Font(None, 48)
|
||||||
# Render text
|
# Render text
|
||||||
text = font.render(msg, 1, (10, 10, 10))
|
text = font.render(msg, 1, (10, 10, 10))
|
||||||
# Position and display text
|
# Position and display text
|
||||||
@@ -135,6 +135,7 @@ class GUI_PyGame:
|
|||||||
# Handle the event
|
# Handle the event
|
||||||
if event.type == pygame.QUIT: return
|
if event.type == pygame.QUIT: return
|
||||||
elif event.type == pygame.KEYDOWN: handle_keypress(event.key)
|
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
|
# Ignore all input that happened inbetween
|
||||||
pygame.event.clear()
|
pygame.event.clear()
|
||||||
|
|
||||||
@@ -216,6 +217,12 @@ def handle_keypress(key):
|
|||||||
elif key == ord('c'):
|
elif key == ord('c'):
|
||||||
take_picture()
|
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):
|
def handle_gpio_event(channel):
|
||||||
"""Implements the actions taken for a GPIO event"""
|
"""Implements the actions taken for a GPIO event"""
|
||||||
if channel == gpio_trigger_channel:
|
if channel == gpio_trigger_channel:
|
||||||
|
|||||||
Reference in New Issue
Block a user