Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions adafruit_ht16k33/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,13 @@ def image(self, img):
)
# Grab all the pixels from the image, faster than getpixel.
pixels = img.convert("1").load()
auto_write = self.auto_write
self._auto_write = False
# Iterate through the pixels
for x in range(self.columns): # yes this double loop is slow,
for y in range(self.rows): # but these displays are small!
self.pixel(x, y, pixels[(x, y)])
self._auto_write = auto_write
if self._auto_write:
self.show()

Expand Down Expand Up @@ -214,6 +217,8 @@ def image(self, img):
)
# Grab all the pixels from the image, faster than getpixel.
pixels = img.convert("RGB").load()
auto_write = self.auto_write
self._auto_write = False
# Iterate through the pixels
for x in range(self.columns): # yes this double loop is slow,
for y in range(self.rows): # but these displays are small!
Expand All @@ -226,5 +231,6 @@ def image(self, img):
else:
# Unknown color, default to LED off.
self.pixel(x, y, self.LED_OFF)
self._auto_write = auto_write
if self._auto_write:
self.show()