Added ability to set text on add_text and added scaling
This commit is contained in:
parent
1b172fe1d5
commit
f054b81f9a
2 changed files with 8 additions and 3 deletions
|
|
@ -149,6 +149,7 @@ class PortalBase:
|
|||
line_spacing=1.25,
|
||||
text_anchor_point=(0, 0.5),
|
||||
is_data=True,
|
||||
text=None,
|
||||
):
|
||||
"""
|
||||
Add text labels with settings
|
||||
|
|
@ -202,7 +203,11 @@ class PortalBase:
|
|||
}
|
||||
self._text.append(text_field)
|
||||
|
||||
return len(self._text) - 1
|
||||
text_index = len(self._text) - 1
|
||||
if text is not None:
|
||||
self.set_text(text, text_index)
|
||||
|
||||
return text_index
|
||||
|
||||
# pylint: enable=too-many-arguments
|
||||
|
||||
|
|
|
|||
|
|
@ -41,14 +41,14 @@ class GraphicsBase:
|
|||
"""
|
||||
|
||||
# pylint: disable=too-many-instance-attributes, too-many-locals, too-many-branches, too-many-statements
|
||||
def __init__(self, display, *, default_bg=0x000000, debug=False):
|
||||
def __init__(self, display, *, default_bg=0x000000, scale=1, debug=False):
|
||||
|
||||
self._debug = debug
|
||||
self.display = display
|
||||
|
||||
if self._debug:
|
||||
print("Init display")
|
||||
self.splash = displayio.Group(max_size=15)
|
||||
self.splash = displayio.Group(max_size=15, scale=scale)
|
||||
self._qr_group = None
|
||||
if self._debug:
|
||||
print("Init background")
|
||||
|
|
|
|||
Loading…
Reference in a new issue