File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,13 @@ def _update_background_color(self, new_color):
190
190
)
191
191
lines = self .text .count ("\n " ) + 1
192
192
if not self ._added_background_tilegrid :
193
- self ._added_background_tilegrid = True
194
- self .insert (0 , self ._create_background_box (lines , y_offset ))
193
+ # only if we have text or padding
194
+ if len (self .text ) + self ._padding_left + self ._padding_right > 0 :
195
+ if len (self ) > 0 :
196
+ self .insert (0 , self ._create_background_box (lines , y_offset ))
197
+ else :
198
+ self .append (self ._create_background_box (lines , y_offset ))
199
+ self ._added_background_tilegrid = True
195
200
else :
196
201
self [0 ] = self ._create_background_box (lines , y_offset )
197
202
@@ -294,6 +299,11 @@ def _update_text(
294
299
self .insert (0 , self ._create_background_box (lines , y_offset ))
295
300
else :
296
301
self [0 ] = self ._create_background_box (lines , y_offset )
302
+ else :
303
+ self ._background_palette .make_transparent (0 )
304
+ if self ._added_background_tilegrid :
305
+ self .pop (0 )
306
+ self ._added_background_tilegrid = False
297
307
298
308
@property
299
309
def bounding_box (self ):
You can’t perform that action at this time.
0 commit comments