Skip to main content

Inkplate 6 MicroPython - Drawing Graphics

Inkplate 6 allows you to draw different geometric shapes anywhere on its 800 x 600 px canvas. The shapes can be filled or hollow.


Drawing shapes

Below is an example that demonstrates how to draw basic shapes in Black-White display mode.

ℹ️
If you want to use the grayscale mode, simply change the constructor value and instead of using inkplate.BLACK use a numeric value: 0-7, where 0 is black and 7 is white.
from inkplate6 import Inkplate
import time

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
Numberx0Center X.
Numbery0Center Y.
NumberrRadius in pixels.
ConstcolorOutline color.

inkplate.fill_circle()

Draw a filled circle.

Function parameters:

TypeNameDescription
Numberx0Center X.
Numbery0Center 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.
NumberwWidth in pixels.
NumberhHeight in pixels.
NumberradiusCorner radius in pixels.
ConstcolorOutline color.

inkplate.fill_round_rect()

Draw a filled rectangle with rounded corners.

Function parameters:

TypeNameDescription
NumberxLeft X.
NumberyTop Y.
NumberwWidth in pixels.
NumberhHeight in pixels.
NumberradiusCorner 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 6 running the example code
Simple predefined shapes.

Full examples

basic_bw.py

Draws the basic shapes and a bitmap in black and white mode.

basic_grayscale.py

Draws the same shapes in 8-level grayscale mode.