@@ -87,7 +87,7 @@ def __init__(
87
87
max_glyphs = len (text )
88
88
# add one to max_size for the background bitmap tileGrid
89
89
super ().__init__ (max_size = 1 )
90
- self .local_group = displayio .Group (max_size = max_glyphs + 1 , scale = scale )
90
+ self .local_group = displayio .Group (max_size = max_glyphs + 1 , scale = scale )
91
91
self .append (self .local_group )
92
92
93
93
self .width = max_glyphs
@@ -119,15 +119,14 @@ def __init__(
119
119
self ._padding_bottom = padding_bottom
120
120
self ._padding_left = padding_left
121
121
self ._padding_right = padding_right
122
-
123
- self ._scale = scale
122
+
123
+ self ._scale = scale
124
124
125
125
if text is not None :
126
126
self ._update_text (str (text ))
127
127
if (anchored_position is not None ) and (anchor_point is not None ):
128
128
self .anchored_position = anchored_position
129
129
130
-
131
130
def _create_background_box (self , lines , y_offset ):
132
131
133
132
left = self ._boundingbox [0 ]
@@ -173,8 +172,6 @@ def _create_background_box(self, lines, y_offset):
173
172
y = y_box_offset ,
174
173
)
175
174
176
-
177
-
178
175
return tile_grid
179
176
180
177
def _update_background_color (self , new_color ):
@@ -203,10 +200,16 @@ def _update_background_color(self, new_color):
203
200
self ._boundingbox [3 ] + self ._padding_top + self ._padding_bottom > 0
204
201
)
205
202
):
206
- if len (self .local_group ) > 0 : # This can be simplified in CP v6.0, when group.append(0) bug is corrected
207
- self .local_group .insert (0 , self ._create_background_box (lines , y_offset ))
203
+ if (
204
+ len (self .local_group ) > 0
205
+ ): # This can be simplified in CP v6.0, when group.append(0) bug is corrected
206
+ self .local_group .insert (
207
+ 0 , self ._create_background_box (lines , y_offset )
208
+ )
208
209
else :
209
- self .local_group .append (self ._create_background_box (lines , y_offset ))
210
+ self .local_group .append (
211
+ self ._create_background_box (lines , y_offset )
212
+ )
210
213
self ._added_background_tilegrid = True
211
214
212
215
else : # a bitmap is present in the self Group
@@ -322,7 +325,7 @@ def line_spacing(self):
322
325
@line_spacing .setter
323
326
def line_spacing (self , spacing ):
324
327
self ._line_spacing = spacing
325
- self .text = self ._text # redraw the box
328
+ self .text = self ._text # redraw the box
326
329
327
330
@property
328
331
def color (self ):
@@ -364,16 +367,15 @@ def text(self, new_text):
364
367
365
368
@property
366
369
def scale (self ):
370
+ """Set the scaling of the label, in integer values"""
367
371
return self ._scale
368
372
369
373
@scale .setter
370
374
def scale (self , new_scale ):
371
- current_anchored_position = self .anchored_position
372
- self ._scale = new_scale
373
- self .local_group .scale = new_scale
374
- self .anchored_position = current_anchored_position
375
-
376
-
375
+ current_anchored_position = self .anchored_position
376
+ self ._scale = new_scale
377
+ self .local_group .scale = new_scale
378
+ self .anchored_position = current_anchored_position
377
379
378
380
@property
379
381
def font (self ):
0 commit comments