code.py
 1  # SPDX-FileCopyrightText: 2021 Tim C, written for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  """
 5  This examples shows how to update your label with new text.
 6  """
 7  import time
 8  import board
 9  import displayio
10  import terminalio
11  from adafruit_display_text import label
12  
13  # built-in display
14  display = board.DISPLAY
15  
16  # Make the display context
17  main_group = displayio.Group()
18  display.show(main_group)
19  
20  # create the label
21  updating_label = label.Label(
22      font=terminalio.FONT, text="Time Is:\n{}".format(time.monotonic()), scale=2
23  )
24  
25  # set label position on the display
26  updating_label.anchor_point = (0, 0)
27  updating_label.anchored_position = (20, 20)
28  
29  # add label to group that is showing on display
30  main_group.append(updating_label)
31  
32  # Main loop
33  while True:
34  
35      # update text property to change the text showing on the display
36      updating_label.text = "Time Is:\n{}".format(time.monotonic())
37  
38      time.sleep(1)