From 3a27d03d958be01e9195262397f46c0c6f08a317 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 27 Jun 2025 11:20:42 -0500 Subject: [PATCH] use new OnDiskBitmap API --- README.rst | 19 +++++++++---------- examples/il91874_simpletest.py | 31 +++++++++++++------------------ 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/README.rst b/README.rst index f8766bf..bad95ee 100644 --- a/README.rst +++ b/README.rst @@ -87,24 +87,23 @@ Usage Example g = displayio.Group() - f = open("/display-ruler.bmp", "rb") - - pic = displayio.OnDiskBitmap(f) - # CircuitPython 6 & 7 compatible - t = displayio.TileGrid( - pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) - ) - # CircuitPython 7 compatible only - # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) + pic = displayio.OnDiskBitmap("/display-ruler.bmp") + # Create a Tilegrid with the bitmap and put in the displayio group + t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) g.append(t) + # Place the display group on the screen (does not refresh) display.root_group = g + # Show the image on the display display.refresh() print("refreshed") - time.sleep(120) + # Do Not refresh the screen more often than every 180 seconds + # for eInk displays! Rapid refreshes will damage the panel. + time.sleep(180) + Documentation ============= diff --git a/examples/il91874_simpletest.py b/examples/il91874_simpletest.py index 08504d2..4938f37 100644 --- a/examples/il91874_simpletest.py +++ b/examples/il91874_simpletest.py @@ -47,25 +47,20 @@ display = adafruit_il91874.IL91874( g = displayio.Group() # Display a ruler graphic from the root directory of the CIRCUITPY drive -with open("/display-ruler.bmp", "rb") as f: - pic = displayio.OnDiskBitmap(f) - # Create a Tilegrid with the bitmap and put in the displayio group - # CircuitPython 6 & 7 compatible - t = displayio.TileGrid( - pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter()) - ) - # CircuitPython 7 compatible only - # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) - g.append(t) - # Place the display group on the screen (does not refresh) - display.root_group = g +pic = displayio.OnDiskBitmap("/display-ruler.bmp") +# Create a Tilegrid with the bitmap and put in the displayio group +t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader) +g.append(t) - # Show the image on the display - display.refresh() +# Place the display group on the screen (does not refresh) +display.root_group = g - print("refreshed") +# Show the image on the display +display.refresh() - # Do Not refresh the screen more often than every 180 seconds - # for eInk displays! Rapid refreshes will damage the panel. - time.sleep(180) +print("refreshed") + +# Do Not refresh the screen more often than every 180 seconds +# for eInk displays! Rapid refreshes will damage the panel. +time.sleep(180)