Skip to content

Commit f054b81

Browse files
committed
Added ability to set text on add_text and added scaling
1 parent 1b172fe commit f054b81

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

adafruit_portalbase/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def add_text(
149149
line_spacing=1.25,
150150
text_anchor_point=(0, 0.5),
151151
is_data=True,
152+
text=None,
152153
):
153154
"""
154155
Add text labels with settings
@@ -202,7 +203,11 @@ def add_text(
202203
}
203204
self._text.append(text_field)
204205

205-
return len(self._text) - 1
206+
text_index = len(self._text) - 1
207+
if text is not None:
208+
self.set_text(text, text_index)
209+
210+
return text_index
206211

207212
# pylint: enable=too-many-arguments
208213

adafruit_portalbase/graphics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ class GraphicsBase:
4141
"""
4242

4343
# pylint: disable=too-many-instance-attributes, too-many-locals, too-many-branches, too-many-statements
44-
def __init__(self, display, *, default_bg=0x000000, debug=False):
44+
def __init__(self, display, *, default_bg=0x000000, scale=1, debug=False):
4545

4646
self._debug = debug
4747
self.display = display
4848

4949
if self._debug:
5050
print("Init display")
51-
self.splash = displayio.Group(max_size=15)
51+
self.splash = displayio.Group(max_size=15, scale=scale)
5252
self._qr_group = None
5353
if self._debug:
5454
print("Init background")

0 commit comments

Comments
 (0)