Skip to content

Commit ce17bf2

Browse files
author
JPOSADA202020
committed
changid_labels_name
1 parent 3de653a commit ce17bf2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/pcf8523_displayio_simpletest.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@
3636

3737
# Create two Labels to show the readings. If you have a very small
3838
# display you may need to change to scale=1.
39-
display_output_label = Label(FONT, text="", scale=2)
40-
display_output_label2 = Label(FONT, text="", scale=2)
39+
date_output_label = Label(FONT, text="", scale=2)
40+
time_output_label = Label(FONT, text="", scale=2)
4141

4242
# place the label in the middle of the screen with anchored positioning
43-
display_output_label.anchor_point = (0, 0)
44-
display_output_label.anchored_position = (4, board.DISPLAY.height // 2)
45-
display_output_label2.anchor_point = (0, 0)
46-
display_output_label2.anchored_position = (4, 10 + board.DISPLAY.height // 2)
43+
date_output_label.anchor_point = (0, 0)
44+
date_output_label.anchored_position = (4, board.DISPLAY.height // 2)
45+
time_output_label.anchor_point = (0, 0)
46+
time_output_label.anchored_position = (4, 20 + board.DISPLAY.height // 2)
4747

4848
# add the label to the main_group
49-
main_group.append(display_output_label)
50-
main_group.append(display_output_label2)
49+
main_group.append(date_output_label)
50+
main_group.append(time_output_label)
5151

5252
# set the main_group as the root_group of the built-in DISPLAY
5353
board.DISPLAY.root_group = main_group
@@ -56,9 +56,9 @@
5656
while True:
5757
# Update the label.text property to change the text on the display
5858
t = rtc.datetime
59-
display_output_label.text = (
59+
date_output_label.text = (
6060
f"The date is {days[int(t.tm_wday)]} {t.tm_mday}/{t.tm_mon}/{t.tm_year}"
6161
)
62-
display_output_label2.text = f"The time is {t.tm_hour}:{t.tm_min:02}:{t.tm_sec:02}"
62+
time_output_label.text = f"The time is {t.tm_hour}:{t.tm_min:02}:{t.tm_sec:02}"
6363
# wait for a bit
6464
time.sleep(1)

0 commit comments

Comments
 (0)