diff --git a/adafruit_portalbase/__init__.py b/adafruit_portalbase/__init__.py index 510784d..6db809b 100755 --- a/adafruit_portalbase/__init__.py +++ b/adafruit_portalbase/__init__.py @@ -55,7 +55,7 @@ class PortalBase: """ - # pylint: disable=too-many-instance-attributes, too-many-branches + # pylint: disable=too-many-instance-attributes, too-many-branches, too-many-public-methods def __init__( self, network, @@ -213,6 +213,21 @@ def add_text( # pylint: enable=too-many-arguments + def remove_all_text(self, clear_font_cache=False): + """Remove all added text and labels. + + :param bool clear_font_cache: Clear the font cache. Defaults to False. + """ + + # Remove the labels + for i in range(len(self._text)): + self.set_text("", i) + # Remove the data + self._text = [] + if clear_font_cache: + self._fonts = {} + gc.collect() + def set_text(self, val, index=0): """Display text, with indexing into our list of text boxes.