Skip to content

Commit d855e29

Browse files
authored
Merge pull request #73 from kmatch98/anchor_params
Added anchor_point and anchor_position options as parameters
2 parents dd13c49 + 9fa93fe commit d855e29

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

adafruit_display_text/label.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Label(displayio.Group):
5858
:param int color: Color of all text in RGB hex
5959
:param double line_spacing: Line spacing of text to display"""
6060

61-
# pylint: disable=too-many-instance-attributes
61+
# pylint: disable=too-many-instance-attributes, too-many-locals
6262
# This has a lot of getters/setters, maybe it needs cleanup.
6363

6464
def __init__(
@@ -77,6 +77,8 @@ def __init__(
7777
padding_bottom=0,
7878
padding_left=0,
7979
padding_right=0,
80+
anchor_point=None,
81+
anchored_position=None,
8082
**kwargs
8183
):
8284
if "scale" in kwargs.keys():
@@ -93,7 +95,10 @@ def __init__(
9395
self.width = max_glyphs
9496
self._font = font
9597
self._text = None
96-
self._anchor_point = (0, 0)
98+
if anchor_point is None:
99+
self._anchor_point = (0, 0)
100+
else:
101+
self._anchor_point = anchor_point
97102
self.x = x
98103
self.y = y
99104

@@ -121,6 +126,8 @@ def __init__(
121126

122127
if text is not None:
123128
self._update_text(str(text))
129+
if anchored_position is not None:
130+
self.anchored_position = anchored_position
124131

125132
def _create_background_box(self, lines, y_offset):
126133

0 commit comments

Comments
 (0)