From 20620df2cbc9f18e43ca554c0370c5479fb7a0bc Mon Sep 17 00:00:00 2001 From: Victor Payno Date: Tue, 14 May 2024 20:44:29 -0700 Subject: [PATCH] python: update symbol browser experiment Add arrows to show which buttons to use. --- python/src/browse-all-symbols.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/python/src/browse-all-symbols.py b/python/src/browse-all-symbols.py index 5e1019c..0bc1e2b 100644 --- a/python/src/browse-all-symbols.py +++ b/python/src/browse-all-symbols.py @@ -5,20 +5,36 @@ index: int = -1 COUNT: int = len(images) + def browse_left(index: int) -> int: + """Scroll carousel to the left. + + :param index: the current position + :return: the new position + """ return (index - 1) % COUNT + def browse_right(index: int) -> int: + """Scroll carousel to the right. + + :param index: the current position + :return: the new position + """ return (index + 1) % COUNT + # Code in a 'while True:' loop repeats forever while True: + display.show(Image.ARROW_E) + sleep(500) + display.show(Image.ARROW_W) + sleep(500) + if button_a.was_pressed(): index = browse_left(index) elif button_b.was_pressed(): index = browse_right(index) - elif pin_logo.is_touched(): - print("INFO: not doing anything since the last image is already in a loop") image: str