Skip to main content

Inkplate 5v2 MicroPython - Drawing graphics

Inkplate 5v2 can draw geometric shapes anywhere on its 1280 x 720 px canvas. Shapes can be filled or hollow.


Drawing shapes

The example below draws basic shapes in black-white display mode.

ℹ️
To use grayscale mode instead, change the constructor value and pass a numeric value from 0 to 7 in place of inkplate.BLACK.
from inkplate5v2 import Inkplate

inkplate = Inkplate(Inkplate.INKPLATE_1BIT)
inkplate.begin()
inkplate.clear_display()
inkplate.display()

inkplate.draw_pixel(100, 100, inkplate.BLACK)
inkplate.draw_rect(50, 50, 75, 75, inkplate.BLACK)
inkplate.draw_circle(200, 200, 30, inkplate.BLACK)
inkplate.fill_circle(300, 300, 30, inkplate.BLACK)
inkplate.draw_fast_hline(20, 100, 50, inkplate.BLACK)
inkplate.draw_fast_vline(100, 20, 50, inkplate.BLACK)
inkplate.draw_line(100, 100, 400, 400, inkplate.BLACK)
inkplate.draw_round_rect(100, 10, 100, 100, 10, inkplate.BLACK)
inkplate.fill_round_rect(10, 100, 100, 100, 10, inkplate.BLACK)
inkplate.draw_triangle(300, 100, 400, 150, 400, 100, inkplate.BLACK)

inkplate.display()

inkplate.draw_pixel()

Set a single pixel in the frame buffer.

Function parameters:

TypeNameDescription
NumberxX coordinate.
NumberyY coordinate.
ConstcolorColor constant (BLACK or WHITE in BW mode).

inkplate.draw_rect()

Draw an unfilled rectangle outline.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberwWidth in pixels.
NumberhHeight in pixels.
ConstcolorOutline color.

inkplate.draw_circle()

Draw an unfilled circle.

Function parameters:

TypeNameDescription
NumberxCenter X.
NumberyCenter Y.
NumberrRadius in pixels.
ConstcolorOutline color.

inkplate.fill_circle()

Draw a filled circle.

Function parameters:

TypeNameDescription
NumberxCenter X.
NumberyCenter Y.
NumberrRadius in pixels.
ConstcolorFill color.

inkplate.draw_fast_hline()

Draw a horizontal line quickly.

Function parameters:

TypeNameDescription
NumberxStart X.
NumberyY position.
NumberwLine width in pixels.
ConstcolorLine color.

inkplate.draw_fast_vline()

Draw a vertical line quickly.

Function parameters:

TypeNameDescription
NumberxX position.
NumberyStart Y.
NumberhLine height in pixels.
ConstcolorLine color.

inkplate.draw_line()

Draw a line from one point to another.

Function parameters:

TypeNameDescription
Numberx0Start X.
Numbery0Start Y.
Numberx1End X.
Numbery1End Y.
ConstcolorLine color.

inkplate.draw_round_rect()

Draw an unfilled rectangle with rounded corners.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberqWidth in pixels.
NumberhHeight in pixels.
NumberrCorner radius in pixels.
ConstcolorOutline color.

inkplate.fill_round_rect()

Draw a filled rectangle with rounded corners.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberqWidth in pixels.
NumberhHeight in pixels.
NumberrCorner radius in pixels.
ConstcolorFill color.

inkplate.draw_triangle()

Draw a triangle outline using three vertices.

Function parameters:

TypeNameDescription
Numberx0Vertex A X.
Numbery0Vertex A Y.
Numberx1Vertex B X.
Numbery1Vertex B Y.
Numberx2Vertex C X.
Numbery2Vertex C Y.
ConstcolorOutline color.
Inkplate 5v2 running the example code
Simple predefined shapes.

Full examples

basic_bw.py

Draw basic black and white shapes on the display.

basic_grayscale.py

Draw different shades of gray using grayscale mode.