Skip to content

Commit 812cb84

Browse files
authored
Merge pull request #13 from ladyada/master
update to latest text zone, Label!
2 parents 185a454 + 3680fa7 commit 812cb84

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

adafruit_pyportal.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@
5555

5656
from adafruit_esp32spi import adafruit_esp32spi
5757
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 ***\nPlease 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
5963
from adafruit_bitmap_font import bitmap_font
6064

6165
import storage
@@ -425,7 +429,7 @@ def set_caption(self, caption_text, caption_position, caption_color):
425429
board.DISPLAY.wait_for_frame()
426430
return
427431

428-
self._caption = TextArea(self._caption_font, text=str(caption_text))
432+
self._caption = Label(self._caption_font, text=str(caption_text))
429433
self._caption.x = caption_position[0]
430434
self._caption.y = caption_position[1]
431435
self._caption.color = caption_color
@@ -452,7 +456,7 @@ def set_text(self, val, index=0):
452456
if item == self._text[index]:
453457
break
454458
items.append(item)
455-
self._text[index] = TextArea(self._text_font, text=string)
459+
self._text[index] = Label(self._text_font, text=string)
456460
self._text[index].color = self._text_color[index]
457461
self._text[index].x = self._text_position[index][0]
458462
self._text[index].y = self._text_position[index][1]
@@ -463,7 +467,7 @@ def set_text(self, val, index=0):
463467

464468
if self._text_position[index]: # if we want it placed somewhere...
465469
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)
467471
self._text[index].color = self._text_color[index]
468472
self._text[index].x = self._text_position[index][0]
469473
self._text[index].y = self._text_position[index][1]

0 commit comments

Comments
 (0)