File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
CircuitPython_sdcardio_sdioio Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 22import time
33
44import board
5- import digitalio
65import displayio
6+
77import mount_sd
88
99display = board .DISPLAY
1010
1111# The bmp files on the sd card will be shown in alphabetical order
12- bmpfiles = sorted ("/sd/" + filename for filename in os .listdir ("/sd" )
13- if filename .lower ().endswith ("bmp" ))
12+ bmpfiles = sorted ("/sd/" + fn for fn in os .listdir ("/sd" ) if fn .lower ().endswith ("bmp" ))
1413
1514while True :
15+ if len (bmpfiles ) == 0 :
16+ print ("No BMP files found" )
17+ break
18+
1619 for filename in bmpfiles :
1720 print ("showing" , filename )
1821
22+ # CircuitPython 6 & 7 compatible
1923 bitmap_file = open (filename , "rb" )
2024 bitmap = displayio .OnDiskBitmap (bitmap_file )
21- tile_grid = displayio .TileGrid (bitmap ,
22- pixel_shader = getattr (bitmap , 'pixel_shader' , displayio .ColorConverter ()))
25+ tile_grid = displayio .TileGrid (
26+ bitmap ,
27+ pixel_shader = getattr (bitmap , 'pixel_shader' , displayio .ColorConverter ())
28+ )
29+
30+ # # CircuitPython 7+ compatible
31+ # bitmap = displayio.OnDiskBitmap(filename)
32+ # tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)
33+
2334 group = displayio .Group ()
2435 group .append (tile_grid )
2536 display .show (group )
You can’t perform that action at this time.
0 commit comments