User Manual

Next we will create a smaller purple square. The easiest way to do this is the create a new bitmap that is a little smaller
than the full screen with a single color and place it in a specific location. In this case we will create a bitmap that is 20
pixels smaller on each side. The screen is 320x240, so we'll want to subtract 40 from each of those numbers.
We'll also want to place it at the position (20, 20) so that it ends up centered.
Since we are adding this after the first square, it's automatically drawn on top. Here's what it looks like now.
inner_bitmap = displayio.Bitmap(280, 200, 1)
inner_palette = displayio.Palette(1)
inner_palette[0] = 0xAA0088 # Purple
inner_sprite = displayio.TileGrid(inner_bitmap,
pixel_shader=inner_palette,
x=20, y=20)
splash.append(inner_sprite)
© Adafruit Industries https://learn.adafruit.com/2-0-inch-320-x-240-color-ips-tft-display Page 23 of 27