From 5fe2117df3acbd92042e4149ec0dddcc5edbbcc9 Mon Sep 17 00:00:00 2001 From: FoamyGuy Date: Sat, 27 Jun 2020 09:20:02 -0500 Subject: [PATCH] fix max_glyphs count when text wasn't passed in constructor --- adafruit_display_text/label.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index 66bfb81..ac081e2 100755 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -82,8 +82,9 @@ def __init__( if not max_glyphs and not text: raise RuntimeError("Please provide a max size, or initial text") if not max_glyphs: - max_glyphs = len(text) + 1 # add one for the background bitmap tileGrid - super().__init__(max_size=max_glyphs, **kwargs) + max_glyphs = len(text) + # add one to max_size for the background bitmap tileGrid + super().__init__(max_size=max_glyphs + 1, **kwargs) self.width = max_glyphs self._font = font