cp7 version of OnDiskBitmap  usage for hallowing magic 9 ball
@@ -25,9 +25,11 @@ ACCEL.range = adafruit_lis3dh.RANGE_4_G
while True:
shaken = False
- with open(images[i], "rb") as f:
+
print("Image load {}".format(images[i]))
+ # CircuitPython 6 & 7 compatible
try:
+ f = open(images[i], "rb")
odb = displayio.OnDiskBitmap(f)
except ValueError:
print("Image unsupported {}".format(images[i]))
@@ -35,6 +37,15 @@ while True:
continue
face = displayio.TileGrid(odb, pixel_shader=getattr(odb, 'pixel_shader', displayio.ColorConverter()))
+ # # CircuitPython 7+ compatible
+ # try:
+ # odb = displayio.OnDiskBitmap(images[i])
+ # except ValueError:
+ # print("Image unsupported {}".format(images[i]))
+ # del images[i]
+ # continue
+ # face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)
+
splash.append(face)
# Wait for the image to load.
try:
