@@ -113,13 +113,6 @@ def __init__(
113
113
self ._background_color = background_color
114
114
self ._background_palette = displayio .Palette (1 )
115
115
self ._added_background_tilegrid = False
116
- if self ._background_color :
117
- self .append (
118
- displayio .TileGrid (
119
- displayio .Bitmap (1 , 1 , 1 ), pixel_shader = self ._background_palette
120
- )
121
- ) # initialize with a blank tilegrid placeholder for background
122
- self ._added_background_tilegrid = True
123
116
124
117
self ._padding_top = padding_top
125
118
self ._padding_bottom = padding_bottom
@@ -180,6 +173,8 @@ def _update_background_color(self, new_color):
180
173
181
174
if new_color is None :
182
175
self ._background_palette .make_transparent (0 )
176
+ self .pop (0 )
177
+ self ._added_background_tilegrid = False
183
178
else :
184
179
self ._background_palette .make_opaque (0 )
185
180
self ._background_palette [0 ] = new_color
@@ -194,7 +189,6 @@ def _update_background_color(self, new_color):
194
189
)
195
190
lines = self .text .count ("\n " ) + 1
196
191
if not self ._added_background_tilegrid :
197
-
198
192
self ._added_background_tilegrid = True
199
193
self .insert (0 , self ._create_background_box (lines , y_offset ))
200
194
else :
@@ -295,7 +289,6 @@ def _update_text(
295
289
and len (new_text ) + self ._padding_left + self ._padding_right > 0
296
290
):
297
291
if not self ._added_background_tilegrid :
298
-
299
292
self ._added_background_tilegrid = True
300
293
self .insert (0 , self ._create_background_box (lines , y_offset ))
301
294
else :
0 commit comments