Skip to content

Commit 7c0c136

Browse files
committed
Intial review of documentation
1 parent 2c2a403 commit 7c0c136

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

adafruit_display_text/label.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,27 @@ class Label(displayio.Group):
3939
:param str text: Text to display
4040
:param int max_glyphs: The largest quantity of glyphs we will display
4141
:param int color: Color of all text in RGB hex
42-
:param double line_spacing: Line spacing of text to display"""
42+
:param float line_spacing: Line spacing of text to display
43+
:param bool background_tight: Set `True` only if you want background box to tightly
44+
surround text. When set to 'True' Padding parameters will be ignored.
45+
:param int padding_top: Additional pixels added to background bounding box at top.
46+
This parameter could be negative indicating additional pixels subtracted to background
47+
bounding box.
48+
:param int padding_bottom: Additional pixels added to background bounding box at bottom.
49+
This parameter could be negative indicating additional pixels subtracted to background
50+
bounding box.
51+
:param int padding_left: Additional pixels added to background bounding box at left.
52+
This parameter could be negative indicating additional pixels subtracted to background
53+
bounding box.
54+
:param int padding_right: Additional pixels added to background bounding box at right.
55+
This parameter could be negative indicating additional pixels subtracted to background
56+
bounding box.
57+
:param (float,float) anchor_point: Point that anchored_position moves relative to.
58+
Tuple with decimal percentage of width and height.
59+
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)
60+
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
61+
containing x,y pixel coordinates.
62+
:param int scale: Integer value of the pixel scaling"""
4363

4464
# pylint: disable=too-many-instance-attributes, too-many-locals
4565
# This has a lot of getters/setters, maybe it needs cleanup.
@@ -120,6 +140,9 @@ def __init__(
120140
self.anchored_position = anchored_position
121141

122142
def _create_background_box(self, lines, y_offset):
143+
"""Private Class function to create a background_box
144+
:param lines: int number of lines
145+
:param y_offset: int y pixel bottom coordinate for the background_box"""
123146

124147
left = self._boundingbox[0]
125148

@@ -156,6 +179,7 @@ def _create_background_box(self, lines, y_offset):
156179
return tile_grid
157180

158181
def _get_ascent_descent(self):
182+
""" Private function to calculate ascent and descent font values """
159183
if hasattr(self.font, "ascent"):
160184
return self.font.ascent, self.font.descent
161185

@@ -179,6 +203,8 @@ def _get_ascent(self):
179203
return self._get_ascent_descent()[0]
180204

181205
def _update_background_color(self, new_color):
206+
""" Private class function that allows updating the font box background color
207+
:param new_color: int color as an RGB hex number."""
182208

183209
if new_color is None:
184210
self._background_palette.make_transparent(0)

0 commit comments

Comments
 (0)