Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion CircuitPython_displayio/displayio_ondiskbitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@

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()))
tile_grid = displayio.TileGrid(
bitmap,
pixel_shader=getattr(bitmap, 'pixel_shader', displayio.ColorConverter())
)

# Create a Group to hold the TileGrid
group = displayio.Group()
Expand All @@ -24,3 +29,25 @@
# 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")

# Create a TileGrid to hold the bitmap
tile_grid = displayio.TileGrid(bitmap, pixel_shader=bitmap.pixel_shader)

# 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
4 changes: 2 additions & 2 deletions CircuitPython_displayio/displayio_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
font = terminalio.FONT
color = 0x0000FF

# Create the tet label
text_area = label.Label(font, text="HELLO WORLD", color=0x00FF00)
# Create the text label
text_area = label.Label(font, text=text, color=color)

# Set the location
text_area.x = 100
Expand Down