Skip to content

Commit b07d03c

Browse files
authored
Merge pull request #29 from kmatch98/master
Update simpletest example for touch "drag-outside" response
2 parents f59ed60 + c9fa5b1 commit b07d03c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

examples/display_button_customfont.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
3+
"""
4+
Button example with a custom font.
5+
"""
36

47
import os
58
import board

examples/display_button_simpletest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
3+
"""
4+
Simple button example.
5+
"""
36

47
import board
58
import displayio
@@ -42,7 +45,7 @@
4245
style=BUTTON_STYLE,
4346
fill_color=BUTTON_FILL_COLOR,
4447
outline_color=BUTTON_OUTLINE_COLOR,
45-
label="HELLO WORLD",
48+
label=BUTTON_LABEL,
4649
label_font=terminalio.FONT,
4750
label_color=BUTTON_LABEL_COLOR,
4851
)
@@ -56,5 +59,7 @@
5659
if p:
5760
if button.contains(p):
5861
button.selected = True
62+
else:
63+
button.selected = False # if touch is dragged outside of button
5964
else:
60-
button.selected = False
65+
button.selected = False # if touch is released

examples/display_button_soundboard.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
3+
"""
4+
Soundboard example with buttons.
5+
"""
36

47
import time
58
from adafruit_pyportal import PyPortal

0 commit comments

Comments
 (0)