Skip to content

Commit 9fce127

Browse files
Update OnDiskBitmap usage to take a filename string in CP7
1 parent ec69daf commit 9fce127

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

CircuitPython_Pyloton/pyloton.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ def show_splash(self):
154154
"""
155155
if self.debug:
156156
return
157-
with open('blinka-pyloton.bmp', 'rb') as bitmap_file:
157+
158+
blinka_bitmap = "blinka-pyloton.bmp"
159+
160+
# Compatible with CircuitPython 6 & 7
161+
with open(blinka_bitmap, 'rb') as bitmap_file:
158162
bitmap1 = displayio.OnDiskBitmap(bitmap_file)
159163
tile_grid = displayio.TileGrid(bitmap1, pixel_shader=getattr(bitmap1, 'pixel_shader', displayio.ColorConverter()))
160164
self.loading_group.append(tile_grid)
@@ -165,6 +169,16 @@ def show_splash(self):
165169
self.loading_group.append(rect)
166170
self.loading_group.append(status_heading)
167171

172+
# # Compatible with CircuitPython 7+
173+
# bitmap1 = displayio.OnDiskBitmap(blinka_bitmap)
174+
# tile_grid = displayio.TileGrid(bitmap1, pixel_shader=bitmap1.pixel_shader)
175+
# self.loading_group.append(tile_grid)
176+
# self.display.show(self.loading_group)
177+
# status_heading = label.Label(font=self.arial16, x=80, y=175,
178+
# text="Status", color=self.YELLOW)
179+
# rect = Rect(0, 165, 240, 75, fill=self.PURPLE)
180+
# self.loading_group.append(rect)
181+
# self.loading_group.append(status_heading)
168182

169183
def _load_fonts(self):
170184
"""

0 commit comments

Comments
 (0)