Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix calls to displayio.TileGrid usage of position #6

Merged
merged 1 commit into from
Mar 14, 2019
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
20 changes: 15 additions & 5 deletions adafruit_display_text/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,26 @@ def _update_text(self, new_text): # pylint: disable=too-many-locals
position_y = y - glyph.height - glyph.dy + y_offset
position_x = x + glyph.dx
if not self._text or old_c >= len(self._text) or character != self._text[old_c]:
face = displayio.TileGrid(glyph.bitmap, pixel_shader=self.palette,
default_tile=glyph.tile_index,
tile_width=glyph.width, tile_height=glyph.height,
position=(position_x, position_y))
try:
face = displayio.TileGrid(glyph.bitmap, pixel_shader=self.palette,
default_tile=glyph.tile_index,
tile_width=glyph.width, tile_height=glyph.height,
position=(position_x, position_y))
except TypeError:
face = displayio.TileGrid(glyph.bitmap, pixel_shader=self.palette,
default_tile=glyph.tile_index,
tile_width=glyph.width, tile_height=glyph.height,
x=position_x, y=position_y)
if i < len(self):
self[i] = face
else:
self.append(face)
elif self._text and character == self._text[old_c]:
self[i].position = (position_x, position_y)
try:
self[i].position = (position_x, position_y)
except AttributeError:
self[i].x = position_x
self[i].y = position_y

x += glyph.shift_x

Expand Down