display_shapes_simpletest.py
1 import board 2 import displayio 3 from adafruit_display_shapes.rect import Rect 4 from adafruit_display_shapes.circle import Circle 5 from adafruit_display_shapes.roundrect import RoundRect 6 7 # Make the display context 8 splash = displayio.Group(max_size=10) 9 board.DISPLAY.show(splash) 10 11 # Make a background color fill 12 color_bitmap = displayio.Bitmap(320, 240, 1) 13 color_palette = displayio.Palette(1) 14 color_palette[0] = 0xFFFFFF 15 bg_sprite = displayio.TileGrid(color_bitmap, x=0, y=0, 16 pixel_shader=color_palette) 17 splash.append(bg_sprite) 18 ########################################################################## 19 20 rect = Rect(80, 20, 41, 41, fill=0x0) 21 splash.append(rect) 22 23 circle = Circle(100, 100, 20, fill=0x00FF00, outline=0xFF00FF) 24 splash.append(circle) 25 26 rect2 = Rect(50, 100, 61, 81, outline=0x0, stroke=3) 27 splash.append(rect2) 28 29 roundrect = RoundRect(10, 10, 61, 81, 10, fill=0x0, outline=0xFF00FF, stroke=6) 30 splash.append(roundrect) 31 32 33 while True: 34 pass