File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ def _reset_text(
264
264
# Calculate both "tight" and "loose" bounding box dimensions to match label for
265
265
# anchor_position calculations
266
266
(
267
- box_x ,
267
+ box_x , # noqa: F841, var assigned not used
268
268
tight_box_y ,
269
269
x_offset ,
270
270
tight_y_offset ,
@@ -288,8 +288,6 @@ def _reset_text(
288
288
y_offset = loose_y_offset
289
289
290
290
# Calculate the background size including padding
291
- tight_box_x = box_x
292
- box_x = box_x + self ._padding_left + self ._padding_right
293
291
box_y = box_y + self ._padding_top + self ._padding_bottom
294
292
295
293
if self .dynamic_height :
@@ -343,8 +341,8 @@ def _reset_text(
343
341
self ._bounding_box = (
344
342
self ._tilegrid .x + self ._padding_left ,
345
343
self ._tilegrid .y + self ._padding_top ,
346
- tight_box_x ,
347
- tight_box_y ,
344
+ self . width ,
345
+ self . height ,
348
346
)
349
347
350
348
if (
Original file line number Diff line number Diff line change 7
7
8
8
from adafruit_display_text .text_box import TextBox
9
9
10
+ display = board .DISPLAY
10
11
main_group = displayio .Group ()
11
12
12
13
left_text = ("Left left left left " * 2 ).rstrip ()
21
22
scale = 1 ,
22
23
)
23
24
24
- left_text_area .x = 10
25
- left_text_area .y = 10
25
+ left_text_area .anchor_point = ( 0 , 0 )
26
+ left_text_area .anchored_position = ( 0 , 0 )
26
27
main_group .append (left_text_area )
27
28
28
29
38
39
scale = 1 ,
39
40
)
40
41
41
- center_text_area .x = 10
42
- center_text_area .y = 10 + left_text_area .height + 10
42
+ center_text_area .anchor_point = ( 0.5 , 0.5 )
43
+ center_text_area .anchored_position = ( display . width // 2 , display .height // 2 )
43
44
main_group .append (center_text_area )
44
45
45
46
55
56
scale = 1 ,
56
57
)
57
58
58
- right_text_area .x = 10
59
- right_text_area .y = center_text_area . y + center_text_area .height + 10
59
+ right_text_area .anchor_point = ( 1.0 , 1.0 )
60
+ right_text_area .anchored_position = ( display . width , display .height )
60
61
main_group .append (right_text_area )
61
62
62
63
board .DISPLAY .root_group = main_group
You can’t perform that action at this time.
0 commit comments