Screen
The screen is a powerful output device, it is capable of rendering text, colours and complex graphics.
Last updated
The screen is a powerful output device, it is capable of rendering text, colours and complex graphics.
Last updated
import board
import terminalio
import displayio
from adafruit_display_text import label
display = board.DISPLAY
# Set text, font, and color
text = "HELLO WORLD"
font = terminalio.FONT
color = 0x0000FF
# Create the text label
text_area = label.Label(font, text=text, color=color)
# Set the location
text_area.x = 50
text_area.y = 80
group = displayio.Group()
group.append(text_area)
# Show it
display.root_group = group
# Loop forever so you can enjoy your image
while True:
passimport board
import time
import displayio
display = board.DISPLAY
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.root_group = group
# Loop forever so you can enjoy your image
while True:
passimport board
import time
import terminalio
from adafruit_display_text import label
import random
import displayio
display = board.DISPLAY
# Set text, font, and color
text = "StudioBot"
font = terminalio.FONT
color = 0x0000FF # Blue
# Create the text label
text_area = label.Label(font, text=text, color=color)
x = 50
y = 80
x_direction = 1
y_direction = 1
# Set the location
text_area.x = x
text_area.y = y
group = displayio.Group()
group.append(text_area)
# Show it
display.root_group = group
# Loop forever so you can enjoy your image
while True:
x = x + 1 * x_direction
y = y + 1 * y_direction
if x >= 150:
x_direction = -1
text_area.color = random.randint(0, 0xFFFFFF)
elif x <= 0:
x_direction = 1
text_area.color = random.randint(0, 0xFFFFFF)
if y >= 120:
y_direction = -1
text_area.color = random.randint(0, 0xFFFFFF)
elif y <= 0:
y_direction = 1
text_area.color = random.randint(0, 0xFFFFFF)
text_area.x = x
text_area.y = y
time.sleep(0.01)