Skip to content
DisplayMITv1.4.7

Adafruit CircuitPython SSD1306

by Adafruit

This is the Python counterpart to Adafruit's Arduino SSD1306 library, but the drawing model is different: instead of direct draw calls onto a built-in buffer, you draw onto a standard Pillow `Image` object using `ImageDraw`, then push the whole frame to the display with `display.image()` followed by `display.show()`. That extra step buys you real TrueType font rendering via `ImageFont.truetype()`, which the Arduino-side GFX library doesn't support out of the box. The tradeoff is that every update redraws the entire frame rather than just a changed region, so very high refresh rate animations are less efficient here than on the Arduino driver's partial-redraw approach.

Installation

pip (MicroPython / Raspberry Pi)

pip install adafruit-circuitpython-ssd1306 pillow

Supported boards

Raspberry Pi

Examples

Draw text with Pillow and flush to the display

The baseline pattern behind the Raspberry Pi SSD1306 example on this site.

import board, busio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306

i2c = busio.I2C(board.SCL, board.SDA)
display = adafruit_ssd1306.SSD1306_I2C(128, 64, i2c, addr=0x3C)

image = Image.new("1", (display.width, display.height))
draw = ImageDraw.Draw(image)
draw.text((0, 0), "Hello, SolderHub", font=ImageFont.load_default(), fill=255)

display.image(image)
display.show()