Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.

CircuitPython displayio for Raspberry Pi - SnakeEyes
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CircuitPython displayio for Raspberry Pi - SnakeEyes

by svojoe on Tue Apr 28, 2020 12:35 pm

Hello - I have an application using the hardware found in the SnakeEyes bonnet kit ( I have run through the SnakeEyes example using a Pi3 - looks cool, but for my use, I need something much simpler - less creepy - even just cartoonish - just movable black pupils on a white background with simple eyelids that blink. I was hoping to program this using CircuitPython and displayio. I've gone through the CircuitPython for Pi guide ( ... spberry-pi), that all seems to work. However, when I try running through the example as found in ... quickstart (which happens to be an example for the exact LCD's I'm using), I get the 'displayio not found' error when trying to run the code.

This brings up the question, is displayio even supported via the adafruit-blinka interface? Has anyone successfully installed and used CircuitPython's displayio on a RPI?

As a side note - I have modified the snake eyes bonnet's RIGHT eye's SPIO_CE0 to be driven from GPIO25 per the SPI notes for CircuitPython in Pi as not to use the real CE0 pin for CS functions. So the start of the example found in ... quickstart, for my particular use, I have the LEFT and RIGHT eye's I/O's defined in the example as such:

import board
import displayio
import terminalio
from adafruit_display_text import label
from adafruit_st7789 import ST7789

# Release any resources currently in use for the displays

#Here's the wiring for SPI #0 (RIGHT Eye):
spi_R = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
tft_cs_R = board.D25
tft_dc_R = board.D5
display_bus_R = displayio.FourWire(spi_R, command=tft_dc_R, chip_select=tft_cs_R, reset=board.D6)
display_R = ST7789(display_bus_R, width=240, height=240, rowstart=80)

#Here's the wiring for SPI #1 (LEFT Eye):
#SCK_1 on GPIO #21
#MOSI_1 on GPIO #20
#MISO_1 on GPIO #19
#SPI #1 CS0 on GPIO 18
#SPI #1 CS1 on GPIO 17
#SPI #1 CS2 on GPIO 16
spi_L = busio.SPI(board.SCK_1, MOSI=board.MOSI_1, MISO=board.MISO_1)
tft_cs_L = board.D16
tft_dc_L = board.D5
display_bus_L = displayio.FourWire(spi_L, command=tft_dc_L, chip_select=tft_cs_L, reset=board.DL)
display_L = ST7789(display_bus_L, width=240, height=240, rowstart=80)

# Make the display context
splash = displayio.Group(max_size=10)


1) So - why is displayio not found when running this example on the Pi?
2) Is there a better graphics library I should be using for this case rather than CircuitPython? Note - I will be reading the joystick inputs from the A/D chip on the Snake Eyes bonnet and positioning the pupils via joystick position - so I would like the black pupils to smoothly move around on the screens. I will also be reading the same A/D chip for pupil size changing.
3) I'm also wanting to run this from a RPI Zero - so the Snake Eyes code would most likely be glitchy anyhow - so I need a simple smooth pupil position movement with the Pi Zero - so whatever library used should be quick and not glitchy...


Posts: 2
Joined: Tue Apr 28, 2020 12:02 pm

Re: CircuitPython displayio for Raspberry Pi - SnakeEyes

by adafruit_support_carter on Tue Apr 28, 2020 8:21 pm

There is no displayio support on the Raspberry Pi. There is an open issue for this here:

Not sure what a good alternative would be. But on a Raspberry Pi, you have access to pretty much all of the main Python eco system. PIL? pygame? PyQt? pi3d?

Posts: 15978
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.