Skip to content

Needs override for remove_all_text from parent portal base to avoid a refresh exception #86

Closed
@diego-wh

Description

@diego-wh

Portalbase has a function to remove all text (remove_all_text) this calls self.set_text to clear the labels.
Since magtag overrides this call to add the option to do a refresh ( auto_refresh: bool = True ) it would be nice to have an override of this function that takes the auto_refresh parameter. If we have more than a couple of labels (text fields) it is likely we will get the Refresh too soon exception.
The code change should be relatively simple (same as parent just passing the extra parameter to set_text). I am unsure if this is part of the scope for this library. I could not find an easy way to remove all objects from the display (maybe I am missing something), but that may be a suitable workaround.
I have been using a work around for my code

def remove_all_text():
    for i in range(count_labels):
        magtag.set_text("", auto_refresh=False, index = i)

where count_labels is a simple counter that increments every time I call add_text. but in this case I don't get the benefit of deleting the _text list ( self._text = [] ).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions