Skip to main content

Inkplate 13SPECTRA MicroPython - Drawing Graphics

Inkplate 13SPECTRA allows you to draw different geometric shapes anywhere on its 1600 x 1200px canvas. The shapes can be filled or hollow.


Drawing shapes

Below is an example that demonstrates how to draw basic shapes in different colors.

from inkplate13_spectra import Inkplate

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

inkplate.draw_pixel(800, 600, inkplate.BLACK)

inkplate.draw_rect(60, 60, 1480, 1080, inkplate.BLACK)
inkplate.draw_rect(80, 80, 1440, 1040, inkplate.BLUE)
inkplate.draw_round_rect(110, 110, 1380, 980, 40, inkplate.YELLOW)

inkplate.draw_line(60, 60, 1540, 1140, inkplate.BLACK)
inkplate.draw_line(1540, 60, 60, 1140, inkplate.BLACK)

inkplate.draw_fast_hline(60, 600, 1480, inkplate.RED)
inkplate.draw_fast_vline(800, 60, 1080, inkplate.GREEN)

inkplate.draw_circle(400, 300, 120, inkplate.BLUE)
inkplate.fill_circle(1200, 300, 120, inkplate.GREEN)
inkplate.draw_circle(1200, 300, 120, inkplate.BLACK)

inkplate.fill_round_rect(220, 760, 420, 300, 35, inkplate.YELLOW)
inkplate.draw_round_rect(220, 760, 420, 300, 35, inkplate.BLACK)

inkplate.fill_rect(980, 760, 420, 300, inkplate.WHITE)
inkplate.draw_rect(980, 760, 420, 300, inkplate.BLACK)

inkplate.draw_triangle(800, 140, 680, 360, 920, 360, inkplate.RED)
inkplate.fill_triangle(800, 520, 650, 720, 950, 720, inkplate.BLUE)
inkplate.draw_triangle(800, 520, 650, 720, 950, 720, inkplate.BLACK)

inkplate.draw_fast_hline(200, 180, 1200, inkplate.YELLOW)
inkplate.draw_fast_hline(200, 1020, 1200, inkplate.YELLOW)
inkplate.draw_fast_vline(220, 200, 800, inkplate.BLUE)
inkplate.draw_fast_vline(1380, 200, 800, inkplate.BLUE)

inkplate.fill_circle(100, 100, 18, inkplate.RED)
inkplate.fill_circle(1500, 100, 18, inkplate.GREEN)
inkplate.fill_circle(100, 1100, 18, inkplate.BLUE)
inkplate.fill_circle(1500, 1100, 18, inkplate.BLACK)

inkplate.draw_rect(50, 50, 75, 75, inkplate.BLUE)
inkplate.draw_circle(200, 200, 30, inkplate.GREEN)
inkplate.fill_circle(300, 300, 30, inkplate.BLACK)
inkplate.draw_fast_hline(20, 100, 50, inkplate.RED)
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.YELLOW)
inkplate.fill_round_rect(10, 100, 100, 100, 10, inkplate.BLACK)
inkplate.draw_triangle(300, 100, 400, 150, 400, 100, inkplate.BLACK)


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

drawing_graphics.py

Full example showing how to draw various shapes in different colors across the full canvas.

inkplate.draw_pixel()

Set a single pixel in the frame buffer.

Function parameters:

TypeNameDescription
NumberxX coordinate.
NumberyY coordinate.
ConstcColor constant (inkplate.BLACK, inkplate.WHITE, inkplate.YELLOW, inkplate.RED, inkplate.BLUE, or inkplate.GREEN).

inkplate.draw_rect()

Draw an unfilled rectangle outline.

Function parameters:

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

inkplate.draw_circle()

Draw an unfilled circle.

Function parameters:

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

inkplate.fill_circle()

Draw a filled circle.

Function parameters:

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

inkplate.draw_fast_hline()

Draw a horizontal line quickly.

Function parameters:

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

inkplate.draw_fast_vline()

Draw a vertical line quickly.

Function parameters:

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

inkplate.draw_line()

Draw a line from one point to another.

Function parameters:

TypeNameDescription
Numberx0Start X.
Numbery0Start Y.
Numberx1End X.
Numbery1End Y.
ConstcLine 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.
NumberrCorner radius in pixels.
ConstcOutline 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.
NumberrCorner radius in pixels.
ConstcFill 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.
ConstcOutline color.