Skip to main content

Inkplate 13SPECTRA MicroPython - Printing text

Inkplate 13SPECTRA allows you to print text on a 1600 x 1200px canvass.

Displaying basic information

Below is a simple example demonstrating the simple way of displaying the information on the Inkplate display.

from inkplate13SPECTRA import Inkplate
import time

inkplate = Inkplate()
inkplate.begin()
inkplate.clearDisplay()
inkplate.display()

# Putting the text in display buffer
inkplate.print("Hello World!")
inkplate.display()

inkplate.print()

Puts the text in display buffer at the current position on display

Function parameters:

TypeNameDescription
StringtextString to render.
Example output displayed on e-paper display
Example output displayed on e-paper display

Displaying text in different colors and more text parameters

Inkplate 13SPECTRA also lets you render color graphics on its canvas. You can also modify different text parameters, such as text color, text size and text wrapping. Below is a simple example demonstrating different text colors and different text styles:

ℹ️

Color parameter in 'setTextColor()' changes text color as per table below:

VALUECOLOR
0Black
1White
2Yellow
3Red
4Blue
5Green
from inkplate13SPECTRA import Inkplate
import time

inkplate=Inkplate()
# Initialize the display, needs to be called only once
inkplate.begin()

# Clear the frame buffer
inkplate.clearDisplay()
inkplate.display()


inkplate.setCursor(50, 50)
inkplate.setTextSize(1)
inkplate.setTextColor(0) # lightest text (white)
inkplate.print("Size 1")

inkplate.setCursor(50, 100)
inkplate.setTextSize(2)
inkplate.setTextColor(1) # light gray
inkplate.print("Size 2")

inkplate.setCursor(50, 180)
inkplate.setTextSize(3)
inkplate.setTextColor(2) # dark gray
inkplate.print("Size 3")

inkplate.setTextColor(3) # darkest text (black)
long_text = (
"This is a very long line of text intended to demonstrate how wrapping works. "
"When wrap mode is enabled, the text will continue onto the next line once it "
"reaches the edge of the display. This makes it possible to write paragraphs "
"or larger blocks of text without worrying about manually inserting line breaks. "
"It is especially useful for rendering user interfaces, menus, or e-books."
)
inkplate.setCursor(50, 340)
inkplate.setTextSize(1)
inkplate.setTextWrapping(True)
inkplate.print(long_text)

inkplate.setCursor(50, 460)
inkplate.setTextSize(1)
inkplate.setTextWrapping(False)
inkplate.print(long_text)

inkplate.display()
Example output displayed on e-paper display
Example output displayed on e-paper display

inkplate.setCursor()

Set the cursor position for the next text to be rendered.

Function parameters:

TypeNameDescription
NumberxX coordinate for the text start.
NumberyY coordinate for the text baseline.

inkplate.setTextSize()

Set the text size scaling factor.

Function parameters:

TypeNameDescription
NumbersizeScale factor (1 = normal, 2 = double, 3 = triple, …).

inkplate.setTextColor

Set the text color (grayscale level) used for text rendering.

Function parameters:

TypeNameDescription
NumbercolorGrayscale value for text (0 = white to 3 = black in 2-bit mode).

inkplate.setTextWrapping()

Enable or disable automatic text wrapping when reaching the display edge.

Returns value: Nothing

Function parameters:

TypeNameDescription
BooleanwrapTrue to wrap text, False to let it continue off-screen.