|
49 | 49 |
|
50 | 50 | import displayio
|
51 | 51 |
|
| 52 | + |
52 | 53 | class Label(displayio.Group):
|
53 | 54 |
|
54 | 55 | # Class variable
|
@@ -161,7 +162,7 @@ def __init__(
|
161 | 162 | y=label_position_yoffset - y_offset - padding_top,
|
162 | 163 | )
|
163 | 164 |
|
164 |
| - # instance the Group |
| 165 | + # instance the Group |
165 | 166 | # this Group will contain just one TileGrid with one contained bitmap
|
166 | 167 | super().__init__(
|
167 | 168 | max_size=1, x=x, y=y, **kwargs
|
@@ -190,12 +191,15 @@ def line_spacing_ypixels(font, line_spacing):
|
190 | 191 | return_value = int(line_spacing * font.get_bounding_box()[1])
|
191 | 192 | return return_value
|
192 | 193 |
|
193 |
| - def text_bounding_box(self, |
194 |
| - text, font, line_spacing, background_tight=False |
| 194 | + def text_bounding_box( |
| 195 | + self, text, font, line_spacing, background_tight=False |
195 | 196 | ): # **** change default background_tight=False
|
196 | 197 |
|
197 | 198 | label_position_yoffset = int( # for calibration with label.py positioning
|
198 |
| - (font.get_glyph(ord("M")).height - font.get_bounding_box()[1] * line_spacing) |
| 199 | + ( |
| 200 | + font.get_glyph(ord("M")).height |
| 201 | + - font.get_bounding_box()[1] * line_spacing |
| 202 | + ) |
199 | 203 | / 2
|
200 | 204 | )
|
201 | 205 |
|
@@ -285,7 +289,8 @@ def text_bounding_box(self,
|
285 | 289 |
|
286 | 290 | return (final_box_width, final_box_height, 0, final_y_offset)
|
287 | 291 |
|
288 |
| - def place_text(self, |
| 292 | + def place_text( |
| 293 | + self, |
289 | 294 | bitmap,
|
290 | 295 | text,
|
291 | 296 | font,
|
@@ -386,8 +391,6 @@ def place_text(self,
|
386 | 391 |
|
387 | 392 | return (left, top, right - left, bottom - top) # bounding_box
|
388 | 393 |
|
389 |
| - |
390 |
| - |
391 | 394 | @property
|
392 | 395 | def anchor_point(self):
|
393 | 396 | """Point that anchored_position moves relative to.
|
|
0 commit comments