Skip to content

Commit 2c4cdab

Browse files
committed
Refresh display function should support CircuitPython 4 and 5
1 parent a8cea0c commit 2c4cdab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

adafruit_pybadger.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,12 @@ def show_business_card(self, *, image_name=None, name_string=None, name_scale=1,
317317
business_card_splash.append(face_image)
318318
for group in business_card_label_groups:
319319
business_card_splash.append(group)
320-
self.display.refresh()
320+
try:
321+
# Refresh display in CircuitPython 5
322+
self.display.refresh()
323+
except AttributeError:
324+
# Refresh display in CircuitPython 4
325+
self.display.wait_for_frame()
321326

322327
# pylint: disable=too-many-locals
323328
def show_badge(self, *, background_color=0xFF0000, foreground_color=0xFFFFFF,

0 commit comments

Comments
 (0)