File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -208,3 +208,24 @@ def refresh(self) -> None:
208208 return
209209 except RuntimeError :
210210 time .sleep (1 )
211+
212+ def remove_all_text (self , auto_refresh = True , clear_font_cache = False ):
213+ """Remove all added text and labels.
214+
215+ :param auto_refresh: Automatically refresh the display after setting the
216+ text. Defaults to True.
217+ :param bool clear_font_cache: Clear the font cache. Defaults to False.
218+ """
219+
220+ # Remove the labels
221+ for i in range (
222+ len (self ._text ) # pylint: disable=access-member-before-definition
223+ ):
224+ self .set_text ("" , auto_refresh = False , index = i )
225+ # Remove the data
226+ self ._text = [] # pylint: disable=attribute-defined-outside-init
227+ if clear_font_cache :
228+ self ._fonts = {} # pylint: disable=attribute-defined-outside-init
229+ if auto_refresh :
230+ self .refresh ()
231+ gc .collect ()
You can’t perform that action at this time.
0 commit comments