Adafruit_Learning_System_Gu.../CircuitPython_displayio/displayio_ondiskbitmap.py
2019-04-30 14:03:07 -07:00

26 lines
619 B
Python

import board
import displayio
display = board.DISPLAY
# 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=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