Skip to main content

Inkplate 10 MicroPython - Printing text

Inkplate 10 allows you to print text on a 1200 x 825 px canvas.

Displaying basic information

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

from inkplate10 import Inkplate
import time

inkplate = Inkplate(Inkplate.INKPLATE_1BIT)
inkplate.begin()
inkplate.clear_display()
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.
Inkplate 10 running the example code
Displaying basic information

Displaying text in grayscale and more text parameters

Inkplate 10 also lets you render grayscale graphics on its canvas, with 8 levels from 0 to 7. 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 using grayscale and different text styles:

ℹ️
The display mode constant is called INKPLATE_2BIT, but the panel actually gives you 8 levels of gray, not 4. Values run from 0 to 7.
ℹ️

The color parameter in set_text_color() changes text color as per the table below:

VALUECOLOR
0Black
1Very dark grey
2Dark grey
3Mid dark grey
4Mid light grey
5Light grey
6Very light grey
7White
from inkplate10 import Inkplate
import time

# Create Inkplate object in 2-bit grayscale mode
inkplate = Inkplate(Inkplate.INKPLATE_2BIT)

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

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


inkplate.set_cursor(50, 50)
inkplate.set_text_size(1)
inkplate.set_text_color(0) # darkest text (black)
inkplate.print("Size 1")

inkplate.set_cursor(50, 100)
inkplate.set_text_size(2)
inkplate.set_text_color(1) # very dark gray
inkplate.print("Size 2")

inkplate.set_cursor(50, 180)
inkplate.set_text_size(3)
inkplate.set_text_color(2) # dark gray
inkplate.print("Size 3")

inkplate.set_text_color(3) # mid gray
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.set_cursor(50, 340)
inkplate.set_text_size(1)
inkplate.set_text_wrapping(True)
inkplate.print(long_text)

inkplate.set_cursor(50, 460)
inkplate.set_text_size(1)
inkplate.set_text_wrapping(False)
inkplate.print(long_text)

inkplate.display()

inkplate.set_cursor()

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.set_text_size()

Set the text size scaling factor.

Function parameters:

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

inkplate.set_text_color()

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

Function parameters:

TypeNameDescription
NumbercolorGrayscale value for text, from 0 (black) to 7 (white) in grayscale mode.

inkplate.set_text_wrapping()

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.
Inkplate 10 running the example code
Simple grayscale example with different text styles.

Full examples

hello_world.py

Display text on the screen.

custom_font.py

Swap in one of the extra typefaces shipped under fonts/ instead of the default font.