Skip to content

Commit bd2c853

Browse files
author
brentru
committed
updateing weather station code to displayio label
1 parent 81ac74c commit bd2c853

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

pyportal_weather_station/weatherstation_helper.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
import board
66
import displayio
7-
from adafruit_display_text.text_area import TextArea
7+
from adafruit_display_text.label import Label
88
from adafruit_bitmap_font import bitmap_font
99

1010
cwd = ("/"+__file__).rsplit('/', 1)[0] # the current working directory (where this file is)
@@ -43,45 +43,43 @@ def __init__(self, celsius=True):
4343
self.medium_font.load_glyphs(glyphs)
4444
self.c_font.load_glyphs(glyphs)
4545

46-
print('setting up textareas...')
47-
self.title_text = TextArea(self.c_font, width=30)
48-
self.title_text.x = 30
49-
self.title_text.y = 0
46+
print('setting up Labels...')
47+
self.title_text = Label(self.c_font, text = "PyPortal Weather Station")
48+
self.title_text.x = 50
49+
self.title_text.y = 10
5050
self._text_group.append(self.title_text)
5151

52-
self.io_status_text = TextArea(self.c_font, width=30)
53-
self.io_status_text.x = 90
52+
self.io_status_text = Label(self.c_font, max_glyphs=30)
53+
self.io_status_text.x = 65
5454
self.io_status_text.y = 190
5555
self._text_group.append(self.io_status_text)
5656

57-
# Set up TextAreas to label sensor data
58-
self.veml_text = TextArea(self.medium_font, width=16)
57+
# Set up Labels to label sensor data
58+
self.veml_text = Label(self.medium_font, max_glyphs=16)
5959
self.veml_text.x = 3
6060
self.veml_text.y = 40
6161
self._text_group.append(self.veml_text)
6262

63-
self.bme_temp_humid_text = TextArea(self.medium_font, width = 50)
63+
self.bme_temp_humid_text = Label(self.medium_font, max_glyphs = 50)
6464
self.bme_temp_humid_text.x = 0
6565
self.bme_temp_humid_text.y = 70
6666
self._text_group.append(self.bme_temp_humid_text)
6767

68-
self.wind_speed_text = TextArea(self.medium_font, width=30)
68+
self.wind_speed_text = Label(self.medium_font, max_glyphs=30)
6969
self.wind_speed_text.x = 0
7070
self.wind_speed_text.y = 100
7171
self._text_group.append(self.wind_speed_text)
7272

73-
self.bme_pres_alt_text = TextArea(self.medium_font, width=50)
73+
self.bme_pres_alt_text = Label(self.medium_font, max_glyphs=50)
7474
self.bme_pres_alt_text.x = 0
7575
self.bme_pres_alt_text.y = 130
7676
self._text_group.append(self.bme_pres_alt_text)
7777

78-
self.sgp_text = TextArea(self.medium_font, width=50)
78+
self.sgp_text = Label(self.medium_font, max_glyphs=50)
7979
self.sgp_text.x = 0
8080
self.sgp_text.y = 155
8181
self._text_group.append(self.sgp_text)
8282

83-
84-
self.title_text.text = "PyPortal Weather Station"
8583
board.DISPLAY.show(self._text_group)
8684

8785
def display_io_status(self, status_text):

0 commit comments

Comments
 (0)