Skip to content

Commit 5076127

Browse files
committed
Updated examples to work in both CP 4 and CP 5
1 parent 56f474b commit 5076127

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

examples/display_text_pyportal.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
y += area.height
3737

3838
# Wait for the image to load.
39-
board.DISPLAY.wait_for_frame()
39+
try:
40+
board.DISPLAY.refresh(target_frames_per_second=60)
41+
except AttributeError:
42+
board.DISPLAY.wait_for_frame()
4043

4144
# Wait for 10 minutes (600 seconds)
4245
time.sleep(600)

examples/display_text_textarea_boundingbox.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@
5353
x=text.x+dims[0], y=text.y+dims[1])
5454
splash.append(textbg_sprite)
5555
splash.append(text)
56-
board.DISPLAY.refresh_soon()
57-
board.DISPLAY.wait_for_frame()
56+
try:
57+
board.DISPLAY.refresh(target_frames_per_second=60)
58+
except AttributeError:
59+
board.DISPLAY.refresh_soon()
60+
board.DISPLAY.wait_for_frame()
5861

5962

6063
while True:

0 commit comments

Comments
 (0)