arrowline¶
Utility function to draw arrow lines using vectorio and tilegride to display it
Author(s): Jose David M
Implementation Notes¶
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
-
class arrowline.Line(grid: displayio.TileGrid | None =
None, x1: int =0, y1: int =0, x2: int =10, y2: int =10, arrow_length: int =10, palette: displayio.Palette | None =None, pal_index: int =1, line_width: int =1, solid_line: bool =True, line_length: int =5, line_space: int =5, pointer: str ='A')[source]¶ A Line Arrow utility.
- Parameters:¶
- grid: displayio.TileGrid | None =
None¶ Tilegrid object where the bitmap will be located, set to None for arbitrary placement of the
Line(default = None)- x1 : int¶
line first point x coordinate
- y1 : int¶
line first point x coordinate
- x2 : int¶
line first point x coordinate
- y2 : int¶
line first point x coordinate
- arrow_length : int¶
arrow length in pixels. Arrow width is half of the length
- palette : displayio.Palette¶
palette object used to display the bitmap. This is used to have the same color for the arrow
- pal_index : int¶
pallet color index used in the bitmap to give the arrow line the color property
- line_width : int¶
the width of the arrow’s line, in pixels (default = 1)
- solid_line : bool¶
indicates if the line is a solid line. Defaults to
True- line_length : int¶
Length in pixels of the line. combinations of line_length and line_space. Defaults to 5.
- line_space : int¶
Line space in pixels. Defaults to 5
- pointer : str¶
point type. Two pointers could be selected
CCircle orAArrow. Defaults to Arrow
- grid: displayio.TileGrid | None =
- Returns:¶
Quickstart: Importing and using line_arrow
Here is one way of importing the
Lineclass so you can use:import displayio import board from CircuitPython_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)Now you can create an arrowline starting at pixel position x=40, y=90 using:
my_line = Line(screen_tilegrid, bitmap, 40, 90, 90, 60, 12, screen_palette, 1)Once you setup your display, you can now add
my_lineto your display using:my_group.append(line) display.show(my_group)Summary: `arrowline` Features and input variables
The
Linewidget has some options for controlling its position, visible appearance, and scale through a collection of input variables:position:
x1,y1,x2,y2size: line length is given by two points.
arrow_lengthcolor:
pal_indexbackground color:
background_color
- property draw¶
Return the line object