55
55
56
56
from adafruit_esp32spi import adafruit_esp32spi
57
57
import adafruit_esp32spi .adafruit_esp32spi_requests as requests
58
- from adafruit_display_text .text_area import TextArea
58
+ try :
59
+ from adafruit_display_text .text_area import TextArea # pylint: disable=unused-import
60
+ print ("*** WARNING ***\n Please update your library bundle to the latest 'adafruit_display_text' version as we've deprecated 'text_area' in favor of 'label'" ) # pylint: disable=line-too-long
61
+ except ImportError :
62
+ from adafruit_display_text .Label import Label
59
63
from adafruit_bitmap_font import bitmap_font
60
64
61
65
import storage
@@ -425,7 +429,7 @@ def set_caption(self, caption_text, caption_position, caption_color):
425
429
board .DISPLAY .wait_for_frame ()
426
430
return
427
431
428
- self ._caption = TextArea (self ._caption_font , text = str (caption_text ))
432
+ self ._caption = Label (self ._caption_font , text = str (caption_text ))
429
433
self ._caption .x = caption_position [0 ]
430
434
self ._caption .y = caption_position [1 ]
431
435
self ._caption .color = caption_color
@@ -452,7 +456,7 @@ def set_text(self, val, index=0):
452
456
if item == self ._text [index ]:
453
457
break
454
458
items .append (item )
455
- self ._text [index ] = TextArea (self ._text_font , text = string )
459
+ self ._text [index ] = Label (self ._text_font , text = string )
456
460
self ._text [index ].color = self ._text_color [index ]
457
461
self ._text [index ].x = self ._text_position [index ][0 ]
458
462
self ._text [index ].y = self ._text_position [index ][1 ]
@@ -463,7 +467,7 @@ def set_text(self, val, index=0):
463
467
464
468
if self ._text_position [index ]: # if we want it placed somewhere...
465
469
print ("Making text area with string:" , string )
466
- self ._text [index ] = TextArea (self ._text_font , text = string )
470
+ self ._text [index ] = Label (self ._text_font , text = string )
467
471
self ._text [index ].color = self ._text_color [index ]
468
472
self ._text [index ].x = self ._text_position [index ][0 ]
469
473
self ._text [index ].y = self ._text_position [index ][1 ]
0 commit comments