Simple test

Ensure your device works with this simple test.

examples/arrowline_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import displayio
import board
from arrowline import Line


display = board.DISPLAY

my_group = displayio.Group()

bitmap = displayio.Bitmap(100, 100, 5)

screen_palette = displayio.Palette(3)
screen_palette[1] = 0x00AA00
screen_tilegrid = displayio.TileGrid(
    bitmap,
    pixel_shader=screen_palette,
    x=50,
    y=50,
)

my_group.append(screen_tilegrid)

line = Line(screen_tilegrid, 40, 90, 90, 60, 12, screen_palette, 1)
my_group.append(line.draw)
display.show(my_group)

while True:
    pass

Multiple Lines Example

Showing multiple lines in a displaay

examples/arrowline_multiple_arrows.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import board
from arrowline import Line


display = board.DISPLAY

my_group = displayio.Group()

bitmap = displayio.Bitmap(300, 300, 5)

screen_palette = displayio.Palette(3)
screen_palette[1] = 0x00AA00
screen_tilegrid = displayio.TileGrid(
    bitmap,
    pixel_shader=screen_palette,
    x=0,
    y=0,
)

my_group.append(screen_tilegrid)

a = Line(screen_tilegrid, 40, 32, 45, 60, 12, screen_palette, 1)
my_group.append(a.draw)
b = Line(screen_tilegrid, 60, 22, 33, 14, 6, screen_palette, 1)
my_group.append(b.draw)
c = Line(screen_tilegrid, 100, 102, 150, 150, 14, screen_palette, 1, pointer="C")
my_group.append(c.draw)
d = Line(screen_tilegrid, 0, 102, 0, 150, 12, screen_palette, 1)
my_group.append(d.draw)
e = Line(screen_tilegrid, 239, 319, 220, 30, 12, screen_palette, 1, pointer="C")
my_group.append(e.draw)
display.show(my_group)

while True:
    pass

Dotted Lines Example

showing multiple dotted lines in a display

examples/arrowline_multiple_arrows.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import board
from arrowline import Line


display = board.DISPLAY

my_group = displayio.Group()

bitmap = displayio.Bitmap(300, 300, 5)

screen_palette = displayio.Palette(3)
screen_palette[1] = 0x00AA00
screen_tilegrid = displayio.TileGrid(
    bitmap,
    pixel_shader=screen_palette,
    x=0,
    y=0,
)

my_group.append(screen_tilegrid)

a = Line(screen_tilegrid, 40, 32, 45, 60, 12, screen_palette, 1)
my_group.append(a.draw)
b = Line(screen_tilegrid, 60, 22, 33, 14, 6, screen_palette, 1)
my_group.append(b.draw)
c = Line(screen_tilegrid, 100, 102, 150, 150, 14, screen_palette, 1, pointer="C")
my_group.append(c.draw)
d = Line(screen_tilegrid, 0, 102, 0, 150, 12, screen_palette, 1)
my_group.append(d.draw)
e = Line(screen_tilegrid, 239, 319, 220, 30, 12, screen_palette, 1, pointer="C")
my_group.append(e.draw)
display.show(my_group)

while True:
    pass

Readme Example

showing multiple dotted lines in a display

examples/arrowline_multiple_arrows.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import board
from arrowline import Line


display = board.DISPLAY

my_group = displayio.Group()

bitmap = displayio.Bitmap(300, 300, 5)

screen_palette = displayio.Palette(3)
screen_palette[1] = 0x00AA00
screen_tilegrid = displayio.TileGrid(
    bitmap,
    pixel_shader=screen_palette,
    x=0,
    y=0,
)

my_group.append(screen_tilegrid)

a = Line(screen_tilegrid, 40, 32, 45, 60, 12, screen_palette, 1)
my_group.append(a.draw)
b = Line(screen_tilegrid, 60, 22, 33, 14, 6, screen_palette, 1)
my_group.append(b.draw)
c = Line(screen_tilegrid, 100, 102, 150, 150, 14, screen_palette, 1, pointer="C")
my_group.append(c.draw)
d = Line(screen_tilegrid, 0, 102, 0, 150, 12, screen_palette, 1)
my_group.append(d.draw)
e = Line(screen_tilegrid, 239, 319, 220, 30, 12, screen_palette, 1, pointer="C")
my_group.append(e.draw)
display.show(my_group)

while True:
    pass