Skip to content

Commit fce4e62

Browse files
authored
Merge pull request #30 from FoamyGuy/odb_api_update
use new OnDiskBitmap API
2 parents 3bc3601 + 5951e02 commit fce4e62

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

examples/gizmo_eink_simpletest.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,17 @@
1515
display_group = displayio.Group()
1616

1717
# Display a ruler graphic from the root directory of the CIRCUITPY drive
18-
with open("/display-ruler.bmp", "rb") as file:
19-
picture = displayio.OnDiskBitmap(file)
20-
# Create a Tilegrid with the bitmap and put in the displayio group
21-
# CircuitPython 6 & 7 compatible
22-
sprite = displayio.TileGrid(
23-
picture,
24-
pixel_shader=getattr(picture, "pixel_shader", displayio.ColorConverter()),
25-
)
26-
# CircuitPython 7 compatible only
27-
# sprite = displayio.TileGrid(picture, pixel_shader=bitmap.pixel_shader)
28-
display_group.append(sprite)
29-
30-
# Place the display group on the screen
31-
display.root_group = display_group
32-
33-
# Refresh the display to have it actually show the image
34-
# NOTE: Do not refresh eInk displays sooner than 180 seconds
35-
display.refresh()
36-
print("refreshed")
37-
38-
time.sleep(180)
18+
picture = displayio.OnDiskBitmap("/display-ruler.bmp")
19+
# Create a Tilegrid with the bitmap and put in the displayio group
20+
sprite = displayio.TileGrid(picture, pixel_shader=picture.pixel_shader)
21+
display_group.append(sprite)
22+
23+
# Place the display group on the screen
24+
display.root_group = display_group
25+
26+
# Refresh the display to have it actually show the image
27+
# NOTE: Do not refresh eInk displays sooner than 180 seconds
28+
display.refresh()
29+
print("refreshed")
30+
31+
time.sleep(180)

0 commit comments

Comments
 (0)