@@ -39,7 +39,27 @@ class Label(displayio.Group):
39
39
:param str text: Text to display
40
40
:param int max_glyphs: The largest quantity of glyphs we will display
41
41
: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"""
43
63
44
64
# pylint: disable=too-many-instance-attributes, too-many-locals
45
65
# This has a lot of getters/setters, maybe it needs cleanup.
@@ -120,6 +140,9 @@ def __init__(
120
140
self .anchored_position = anchored_position
121
141
122
142
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"""
123
146
124
147
left = self ._boundingbox [0 ]
125
148
@@ -156,6 +179,7 @@ def _create_background_box(self, lines, y_offset):
156
179
return tile_grid
157
180
158
181
def _get_ascent_descent (self ):
182
+ """ Private function to calculate ascent and descent font values """
159
183
if hasattr (self .font , "ascent" ):
160
184
return self .font .ascent , self .font .descent
161
185
@@ -179,6 +203,8 @@ def _get_ascent(self):
179
203
return self ._get_ascent_descent ()[0 ]
180
204
181
205
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."""
182
208
183
209
if new_color is None :
184
210
self ._background_palette .make_transparent (0 )
0 commit comments