|
1 | 1 | """
|
2 |
| -This test will initialize the display using displayio |
3 |
| -and draw a solid red background |
| 2 | +This test will initialize the display using displayio and draw a solid green |
| 3 | +background, a smaller purple rectangle, and some yellow text. |
4 | 4 | """
|
5 | 5 |
|
6 | 6 | import board
|
7 | 7 | import displayio
|
| 8 | +import terminalio |
| 9 | +from adafruit_display_text import label |
8 | 10 | from adafruit_ssd1331 import SSD1331
|
9 | 11 |
|
10 | 12 | spi = board.SPI()
|
|
20 | 22 | splash = displayio.Group(max_size=10)
|
21 | 23 | display.show(splash)
|
22 | 24 |
|
23 |
| -color_bitmap = displayio.Bitmap(128, 128, 1) |
| 25 | +color_bitmap = displayio.Bitmap(96, 64, 1) |
24 | 26 | color_palette = displayio.Palette(1)
|
25 |
| -color_palette[0] = 0xFF0000 |
| 27 | +color_palette[0] = 0x00FF00 # Bright Green |
26 | 28 |
|
27 | 29 | bg_sprite = displayio.TileGrid(color_bitmap,
|
28 | 30 | pixel_shader=color_palette,
|
29 | 31 | x=0, y=0)
|
30 | 32 | splash.append(bg_sprite)
|
31 | 33 |
|
| 34 | +# Draw a smaller inner rectangle |
| 35 | +inner_bitmap = displayio.Bitmap(86, 54, 1) |
| 36 | +inner_palette = displayio.Palette(1) |
| 37 | +inner_palette[0] = 0xAA0088 # Purple |
| 38 | +inner_sprite = displayio.TileGrid(inner_bitmap, |
| 39 | + pixel_shader=inner_palette, |
| 40 | + x=5, y=5) |
| 41 | +splash.append(inner_sprite) |
| 42 | + |
| 43 | +# Draw a label |
| 44 | +text = "Hello World!" |
| 45 | +text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00, x=12, y=32) |
| 46 | +splash.append(text_area) |
| 47 | + |
32 | 48 | while True:
|
33 | 49 | pass
|
0 commit comments