diff --git a/examples/gizmo_eink_simpletest.py b/examples/gizmo_eink_simpletest.py index 2800d47..3392c64 100644 --- a/examples/gizmo_eink_simpletest.py +++ b/examples/gizmo_eink_simpletest.py @@ -13,19 +13,18 @@ display_group = displayio.Group() # Display a ruler graphic from the root directory of the CIRCUITPY drive -file = open("/display-ruler.bmp", "rb") +with open("/display-ruler.bmp", "rb") as file: + picture = displayio.OnDiskBitmap(file) + # Create a Tilegrid with the bitmap and put in the displayio group + sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter()) + display_group.append(sprite) -picture = displayio.OnDiskBitmap(file) -# Create a Tilegrid with the bitmap and put in the displayio group -sprite = displayio.TileGrid(picture, pixel_shader=displayio.ColorConverter()) -display_group.append(sprite) + # Place the display group on the screen + display.show(display_group) -# Place the display group on the screen -display.show(display_group) + # Refresh the display to have it actually show the image + # NOTE: Do not refresh eInk displays sooner than 180 seconds + display.refresh() + print("refreshed") -# Refresh the display to have it actually show the image -# NOTE: Do not refresh eInk displays sooner than 180 seconds -display.refresh() -print("refreshed") - -time.sleep(180) + time.sleep(180)