Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit cd1dd3e

Browse files
authored
Merge pull request #31 from kattni/slice-fix
Fix slice indices failure.
2 parents fb62b08 + be25ffa commit cd1dd3e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_pypixelbuf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ def _set_item(
289289

290290
def __setitem__(self, index, val):
291291
if isinstance(index, slice):
292-
start, stop, step = index.indices(self._pixels)
292+
start = index.start if index.start is not None else 0
293+
stop = index.stop if index.stop is not None else len(self)
294+
step = index.step if index.step is not None else 1
293295
for val_i, in_i in enumerate(range(start, stop, step)):
294296
r, g, b, w = self._parse_color(val[val_i])
295297
self._set_item(in_i, r, g, b, w)

0 commit comments

Comments
 (0)