@@ -238,25 +238,22 @@ def set_text(self, val, index=0):
238
238
elif self ._debug :
239
239
print ("Creating text area with :" , string )
240
240
241
- if len (string ) > 0 :
242
- self ._text [index ]["label" ] = Label (
243
- self ._fonts [self ._text [index ]["font" ]],
244
- text = string ,
245
- scale = self ._text [index ]["scale" ],
246
- )
241
+ if len (string .strip ()) > 0 :
242
+ if self ._text [index ]["label" ] is None :
243
+ self ._text [index ]["label" ] = Label (
244
+ self ._fonts [self ._text [index ]["font" ]],
245
+ text = string ,
246
+ scale = self ._text [index ]["scale" ],
247
+ )
247
248
self ._text [index ]["label" ].color = self ._text [index ]["color" ]
248
249
self ._text [index ]["label" ].anchor_point = self ._text [index ]["anchor_point" ]
249
250
self ._text [index ]["label" ].anchored_position = self ._text [index ]["position" ]
250
251
self ._text [index ]["label" ].line_spacing = self ._text [index ]["line_spacing" ]
251
252
elif index_in_splash is not None :
252
253
self ._text [index ]["label" ] = None
254
+ del self .splash [index_in_splash ]
253
255
254
- if index_in_splash is not None :
255
- if self ._text [index ]["label" ] is not None :
256
- self .splash [index_in_splash ] = self ._text [index ]["label" ]
257
- else :
258
- del self .splash [index_in_splash ]
259
- elif self ._text [index ]["label" ] is not None :
256
+ if self ._text [index ]["label" ] is not None and index_in_splash is None :
260
257
self .splash .append (self ._text [index ]["label" ])
261
258
262
259
def preload_font (self , glyphs = None , index = 0 ):
0 commit comments