From 028e1a76c057eab1f82eca5ddaf165c518e9577d Mon Sep 17 00:00:00 2001 From: James Carr Date: Fri, 6 Aug 2021 22:21:18 +0100 Subject: [PATCH] Update OnDiskBitmap code to take a filename string with CP7. --- RBG_Matrix/code.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/RBG_Matrix/code.py b/RBG_Matrix/code.py index 60f999f30..86272fc20 100644 --- a/RBG_Matrix/code.py +++ b/RBG_Matrix/code.py @@ -46,11 +46,24 @@ display.show(g) display.auto_refresh = True + +# CircuitPython 6 & 7 compatible bitmap_file = open("/rbg.bmp", "rb") # Setup the file as the bitmap data source bitmap = displayio.OnDiskBitmap(bitmap_file) # Create a TileGrid to hold the bitmap -tile_grid = displayio.TileGrid(bitmap, pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter())) +tile_grid = displayio.TileGrid( + bitmap, + pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter()) +) + +# # CircuitPython 7+ compatible +# # Setup the filename as the bitmap data source +# bitmap = displayio.OnDiskBitmap("/rbg.bmp") +# # Create a TileGrid to hold the bitmap +# tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader) + + print(dir(tile_grid)) while True: