I'm running "Adafruit CircuitPython 8.0.0-beta.6-28-g6013cde6a on 2023-01-05; Adafruit Matrix Portal M4 with samd51j19".
I've successfully used every argument in every shape in the adafruit_display_shapes library, with the exception of "colors" and "close" in Polygon.
When I try to use those I get a:
Traceback (most recent call last):
File "code.py", line 65, in <module>
TypeError: unexpected keyword argument 'close'
Same for "color".
Below is a sample case I made to demonstrate the issue. It gets interpreted (and generates a shape on the LED matrix) for those instances that exclude used "color" and "close".
I've read the doc and these are shown as optional parameters there.
I've also read the source code for polygon on github and in the preamble these also appear to be optional.
I've done a binary compare of the polygon.mpy on the Matrix Portal with the same file in the 8.0.0 beta library and they are identical, so it's not a case of the one on the Matrix Portal being out-of-sync.
Any help that can be given would be appreciated. Here's my sample code. If you can get "colors" and "close" to work, please let me know how. Thanks.
Code: Select all
from gc import enable, collect, mem_free
from time import monotonic, sleep
from displayio import release_displays, Bitmap, Palette, TileGrid, Group
from terminalio import FONT
from random import randint, uniform
from adafruit_matrixportal.matrix import Matrix
from adafruit_display_shapes.polygon import Polygon
enable()
release_displays()
matrix = Matrix(width=64, height=32, bit_depth=4)
bitmap = Bitmap(64, 32, 16)
palette = Palette(16)
tile_grid = TileGrid(bitmap, pixel_shader=palette)
group = Group()
matrix.display.show(group)
color_dict = dict(
black=0x000000,
blue=0x0000FF,
coral=0xFF4040,
cyan=0x00FFFF,
green=0x004000,
grey=0x404040,
lime=0x00FF00,
magenta=0xFF00FF,
maroon=0x400000,
navy=0x000040,
olive=0x404000,
purple=0x400040,
red=0xFF0000,
teal=0x004040,
white=0xFFFFFF,
yellow=0xFFFF00,
)
palette[0] = color_dict["black"]
palette[1] = color_dict["white"]
palette[2] = color_dict["red"]
palette[3] = color_dict["lime"]
palette[4] = color_dict["blue"]
palette[5] = color_dict["yellow"]
palette[6] = color_dict["cyan"]
palette[7] = color_dict["magenta"]
palette[8] = color_dict["coral"]
palette[9] = color_dict["grey"]
palette[10] = color_dict["maroon"]
palette[11] = color_dict["green"]
palette[12] = color_dict["navy"]
palette[13] = color_dict["olive"]
palette[14] = color_dict["teal"]
palette[15] = color_dict["purple"]
while True:
outlinex = palette[randint(1, 15)]
v1 = (randint(0, 63), randint(0, 31))
v2 = (randint(0, 63), randint(0, 31))
v3 = (randint(0, 63), randint(0, 31))
v4 = (randint(0, 63), randint(0, 31))
listx = [v1, v2, v3, v4]
polygon = Polygon([v1, v2, v3, v4], outline=outlinex)
group.append(polygon)
polygon = Polygon(points=listx, outline=outlinex)
group.append(polygon)
polygon = Polygon([v1, v2, v3, v4])
group.append(polygon)
polygon = Polygon(points=listx)
group.append(polygon)
polygon = Polygon([v1, v2, v3, v4], outline=outlinex, close=True,colors=1)
group.append(polygon)
input("post append")