Skip to content

Commit

Permalink
word_clock.py: handle missing background error
Browse files Browse the repository at this point in the history
  • Loading branch information
thirdr committed Nov 25, 2024
1 parent bc3faac commit cc81de9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions examples/word_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,17 @@ def draw():

# Set the background in layer 0
# This means we don't need to decode the image every frame
p = pngdec.PNG(display)

display.set_layer(0)
p.open_file("wordclock_background.png")
p.decode(0, 0)

try:
p = pngdec.PNG(display)

p.open_file("wordclock_background.png")
p.decode(0, 0)
except OSError:
display.set_pen(BLACK)
display.clear()


while True:
Expand Down

0 comments on commit cc81de9

Please sign in to comment.