Skip to content

Commit 1b8285f

Browse files
authored
Merge pull request #21 from FoamyGuy/odb_api_update
Use new OnDiskBitmap API
2 parents a79280c + bf45e79 commit 1b8285f

File tree

2 files changed

+26
-32
lines changed

2 files changed

+26
-32
lines changed

README.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,23 @@ Usage Example
8787
8888
g = displayio.Group()
8989
90-
f = open("/display-ruler.bmp", "rb")
91-
92-
pic = displayio.OnDiskBitmap(f)
93-
# CircuitPython 6 & 7 compatible
94-
t = displayio.TileGrid(
95-
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
96-
)
97-
# CircuitPython 7 compatible only
98-
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
90+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
91+
# Create a Tilegrid with the bitmap and put in the displayio group
92+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
9993
g.append(t)
10094
95+
# Place the display group on the screen (does not refresh)
10196
display.root_group = g
10297
98+
# Show the image on the display
10399
display.refresh()
104100
105101
print("refreshed")
106102
107-
time.sleep(120)
103+
# Do Not refresh the screen more often than every 180 seconds
104+
# for eInk displays! Rapid refreshes will damage the panel.
105+
time.sleep(180)
106+
108107
109108
Documentation
110109
=============

examples/il91874_simpletest.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,20 @@
4747
g = displayio.Group()
4848

4949
# Display a ruler graphic from the root directory of the CIRCUITPY drive
50-
with open("/display-ruler.bmp", "rb") as f:
51-
pic = displayio.OnDiskBitmap(f)
52-
# Create a Tilegrid with the bitmap and put in the displayio group
53-
# CircuitPython 6 & 7 compatible
54-
t = displayio.TileGrid(
55-
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
56-
)
57-
# CircuitPython 7 compatible only
58-
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
59-
g.append(t)
60-
61-
# Place the display group on the screen (does not refresh)
62-
display.root_group = g
63-
64-
# Show the image on the display
65-
display.refresh()
66-
67-
print("refreshed")
68-
69-
# Do Not refresh the screen more often than every 180 seconds
70-
# for eInk displays! Rapid refreshes will damage the panel.
71-
time.sleep(180)
50+
51+
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
52+
# Create a Tilegrid with the bitmap and put in the displayio group
53+
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
54+
g.append(t)
55+
56+
# Place the display group on the screen (does not refresh)
57+
display.root_group = g
58+
59+
# Show the image on the display
60+
display.refresh()
61+
62+
print("refreshed")
63+
64+
# Do Not refresh the screen more often than every 180 seconds
65+
# for eInk displays! Rapid refreshes will damage the panel.
66+
time.sleep(180)

0 commit comments

Comments
 (0)