Skip to content

Commit 30d001e

Browse files
committed
Fix bug for bitmap_label's anchor_point, anchored_position and scale
1 parent 90f053a commit 30d001e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,12 @@ def _reset_text(
198198
if padding_right is not None:
199199
self._padding_right = max(0, padding_right)
200200
if anchor_point is not None:
201-
self.anchor_point = anchor_point
201+
self._anchor_point = anchor_point
202202
if anchored_position is not None:
203203
self._anchored_position = anchored_position
204204
if save_text is not None:
205205
self._save_text = save_text
206-
if (
207-
scale is not None
208-
): # Scale will be defined in local_group (Note: self should have scale=1)
209-
self.scale = scale # call the setter
206+
210207

211208
# if text is not provided as a parameter (text is None), use the previous value.
212209
if (text is None) and self._save_text:
@@ -229,8 +226,8 @@ def _reset_text(
229226
0, # zero height with text == ""
230227
)
231228
# Clear out any items in the self Group, in case this is an update to the bitmap_label
232-
for _ in self:
233-
self.pop(0)
229+
for _ in self.local_group:
230+
self.local_group.pop(0)
234231

235232
else: # The text string is not empty, so create the Bitmap and TileGrid and
236233
# append to the self Group
@@ -308,11 +305,19 @@ def _reset_text(
308305
tight_box_y,
309306
)
310307

308+
309+
if (
310+
scale is not None
311+
): # Scale will be defined in local_group (Note: self should have scale=1)
312+
self.scale = scale # call the setter
313+
311314
self.anchored_position = (
312315
self._anchored_position
313316
) # set the anchored_position with setter after bitmap is created, sets the
314317
# x,y positions of the label
315318

319+
320+
316321
@staticmethod
317322
def _line_spacing_ypixels(font, line_spacing):
318323
# Note: Scaling is provided at the Group level

0 commit comments

Comments
 (0)