Skip to content

Line

Lines are drawn between a starting point (x1, y1) and an ending point (x2, y2).

Creating a Line

You can create a Line using the following functions:

line = Line(x1, y1, x2, y2)
Line(x1, y1, x2, y2, color, thickness, rotation, visibility)
Parameter Type Default Description
x1 int or float required The horizontal position of one end, in pixels.
y1 int or float required The vertical position of one end, in pixels.
x2 int or float required The horizontal position of the other end, in pixels.
y2 int or float required The vertical position of the other end, in pixels.
color Color Color.BLACK The color.
thickness int 1 The line thickness, in pixels.
rotation int or float 0 How far to turn the line, in degrees, counter-clockwise.
visibility int 100 How visible the line is, from 0 (invisible) to 100 (fully visible).

For example,

line = Line(100, 100, 200, 200)

Once created, you can add it to a Display using the Display's add() function.

Functions

Once a Line has been created, the following functions are available: