Skip to content

Added anchor_point and anchor_position options as parameters #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions adafruit_display_text/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Label(displayio.Group):
:param int color: Color of all text in RGB hex
:param double line_spacing: Line spacing of text to display"""

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

def __init__(
Expand All @@ -77,6 +77,8 @@ def __init__(
padding_bottom=0,
padding_left=0,
padding_right=0,
anchor_point=None,
anchored_position=None,
**kwargs
):
if "scale" in kwargs.keys():
Expand All @@ -93,7 +95,10 @@ def __init__(
self.width = max_glyphs
self._font = font
self._text = None
self._anchor_point = (0, 0)
if anchor_point is None:
self._anchor_point = (0, 0)
else:
self._anchor_point = anchor_point
self.x = x
self.y = y

Expand Down Expand Up @@ -121,6 +126,8 @@ def __init__(

if text is not None:
self._update_text(str(text))
if anchored_position is not None:
self.anchored_position = anchored_position

def _create_background_box(self, lines, y_offset):

Expand Down