Merge pull request #2171 from FoamyGuy/displayio_cp_7
update ondiskbitmap usage for circuitpython 7+, remove fallback for 6
This commit is contained in:
commit
d017b96efe
1 changed files with 0 additions and 30 deletions
|
|
@ -7,36 +7,6 @@ import displayio
|
|||
|
||||
display = board.DISPLAY
|
||||
|
||||
# Current method valid for CircuitPython 6 & 7
|
||||
|
||||
# Open the file
|
||||
with open("/purple.bmp", "rb") as bitmap_file:
|
||||
|
||||
# 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())
|
||||
)
|
||||
|
||||
# Create a Group to hold the TileGrid
|
||||
group = displayio.Group()
|
||||
|
||||
# Add the TileGrid to the Group
|
||||
group.append(tile_grid)
|
||||
|
||||
# Add the Group to the Display
|
||||
display.show(group)
|
||||
|
||||
# Loop forever so you can enjoy your image
|
||||
while True:
|
||||
pass
|
||||
|
||||
|
||||
# Future method for CircuitPython 7 onwards
|
||||
|
||||
# Setup the file as the bitmap data source
|
||||
bitmap = displayio.OnDiskBitmap("/purple.bmp")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue