一、显示一个像素点

    1. import board
    2. import displayio
    3. import busio
    4. display = board.DISPLAY
    5. splash = displayio.Group(max_size=2)
    6. display.show(splash)
    7. bitmap = displayio.Bitmap(30, 30, 1)
    8. palette = displayio.Palette(2)
    9. palette[0] = 0x000000
    10. palette[1] = 0xffffff
    11. tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette)
    12. group = displayio.Group()
    13. group.append(tile_grid)
    14. display.show(group)
    15. bitmap[20, 20] = 1

    二、显示一个bmp图片

    三、显示文本文字

    1. import board
    2. import displayio
    3. from adafruit_bitmap_font import bitmap_font
    4. from adafruit_display_text import label
    5. display = board.DISPLAY
    6. text = "HELLO WORLD"
    7. font = bitmap_font.load_font("fonts/Helvetica-Bold-16.bdf")
    8. color = 0x0000FF
    9. text_area = label.Label(font, text=text, color=color)
    10. # Set the location
    11. #text_area.x = 80
    12. #text_area.y = 60
    13. # Set in center 80=160/2 60=120/2
    14. text_area.anchor_point = (0.5, 0.5)
    15. text_area.anchored_position = (80, 60)
    16. display.show(text_area)
    17. while True:
    18. pass