Skip to content

use new OnDiskBitmap init API #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,8 @@ Usage Example

g = displayio.Group()

# CircuitPython 6 & 7 compatible
f = open("/display-ruler.bmp", "rb")
pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
)

# # CircuitPython 7 compatible only
# pic = displayio.OnDiskBitmap("/display-ruler.bmp")
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)

g.append(t)

Expand Down
26 changes: 13 additions & 13 deletions examples/ssd1680_2.13_featherwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)

t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")

g.append(t)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)

display.root_group = g
g.append(t)

display.refresh()
display.root_group = g

print("refreshed")
display.refresh()

time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")
print("refreshed")

time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")


# Keep the display the same
Expand Down
26 changes: 13 additions & 13 deletions examples/ssd1680_2.13_mono_eink_bonnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@

g = displayio.Group()

with open("display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.refresh()
display.root_group = g

print("refreshed")
display.refresh()

time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")
print("refreshed")

time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")


# Keep the display the same
Expand Down
16 changes: 8 additions & 8 deletions examples/ssd1680_2.13_tricolor_breakout.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)

t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")

g.append(t)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)

display.root_group = g
g.append(t)

display.refresh()
display.root_group = g

print("refreshed")
display.refresh()

time.sleep(120)
print("refreshed")

time.sleep(120)
16 changes: 8 additions & 8 deletions examples/ssd1680_2.9_tricolor_breakout.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@

g = displayio.Group()

with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)

t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")

g.append(t)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)

display.root_group = g
g.append(t)

display.refresh()
display.root_group = g

print("refreshed")
display.refresh()

time.sleep(120)
print("refreshed")

time.sleep(120)
26 changes: 13 additions & 13 deletions examples/ssd1680_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@
g = displayio.Group()

# Note: Check the name of the file. Sometimes the dash is changed to an underscore
with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.root_group = g
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)

display.refresh()
display.root_group = g

print("refreshed")
display.refresh()

time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")
print("refreshed")

time.sleep(display.time_to_refresh + 5)
# Always refresh a little longer. It's not a problem to refresh
# a few seconds more, but it's terrible to refresh too early
# (the display will throw an exception when if the refresh
# is too soon)
print("waited correct time")


# Keep the display the same
Expand Down