21
21
22
22
* Adafruit CircuitPython firmware for the supported boards:
23
23
https://github.com/adafruit/circuitpython/releases
24
-
25
- * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Display_Text
26
24
"""
27
25
28
26
import board
@@ -62,9 +60,9 @@ def __init__( # pylint: disable=too-many-arguments
62
60
self ,
63
61
title = None ,
64
62
title_color = (255 , 255 , 255 ),
65
- title_scale = 1 ,
66
- title_length = 80 ,
67
- text_scale = 1 ,
63
+ title_scale : int = 1 ,
64
+ title_length : int = 80 ,
65
+ text_scale : int = 1 ,
68
66
font = None ,
69
67
colors = None ,
70
68
display = None ,
@@ -78,39 +76,37 @@ def __init__( # pylint: disable=too-many-arguments
78
76
must include the data call in the loop by using ``.text =``. For example, if setup is saved
79
77
as ``temperature_data = simple_text_display()`` then ``temperature_data[0].text =
80
78
microcontroller.cpu.temperature`` must be inside the ``while True:`` loop for the
81
- temperature data displayed to update as the values change. You must call `` show()` ` at the
79
+ temperature data displayed to update as the values change. You must call `show()` at the
82
80
end of the list for anything to display. See example below for usage.
83
81
84
- :param str title: The title displayed above the data. Set ``title="Title text"`` to provide
85
- a title. Defaults to None.
86
- :param title_color: The color of the title. Not necessary if no title is provided. Defaults
87
- to white (255, 255, 255).
82
+ :param None, str title: The title displayed above the data. Set ``title="Title text"`` to
83
+ provide a title. Defaults to ` None` .
84
+ :param None,Tuple(int,int,int) title_color: The color of the title. Not necessary if no
85
+ title is provided. Defaults to white (255, 255, 255).
88
86
:param int title_scale: Scale the size of the title. Not necessary if no title is provided.
89
- Defaults to 1.
87
+ Defaults to 1.
90
88
:param int title_length: The maximum number of characters allowed in the title. Only
91
- necessary if the title is longer than the default 80 characters.
92
- Defaults to 80.
89
+ necessary if the title is longer than the default 80 characters. Defaults to 80.
93
90
:param int text_scale: Scale the size of the data lines. Scales the title as well.
94
- Defaults to 1.
95
- :param str font: The font to use to display the title and data. Defaults to
96
- ``terminalio.FONT``.
97
- :param colors: A list of colors for the lines of data on the display. If you provide a
98
- single color, all lines will be that color. Otherwise it will cycle through
99
- the list you provide if the list is less than the number of lines displayed.
100
- Default colors are used if ``colors`` is not set. For example, if creating
101
- two lines of data, ``colors=((255, 255, 255), (255, 0, 0))`` would set the
102
- first line white and the second line red, and if you created four lines of
103
- data with the same setup, it would alternate white and red. You can also use
104
- the colors built into the library. For example, if you import the library
105
- as ``from adafruit_simple_text_display import SimpleTextDisplay``, you can
106
- indicate the colors as follows:
107
- ``colors=(SimpleDisplayText.WHITE, SimpleDisplayText.RED)``.
108
- :param display: The display object. Defaults to assuming a built-in display. To use with an
109
- external display, instantiate the display object and provide it here.
110
- Defaults to ``board.DISPLAY``.
91
+ Defaults to 1.
92
+ :param ~fontio.BuiltinFont,~adafruit_bitmap_font.bdf.BDF,~adafruit_bitmap_font.pcf.PCF font:
93
+ The font to use to display the title and data. Defaults to `terminalio.FONT`.
94
+ :param None,Tuple(Tuple(int,int,int),...) colors: A list of colors for the lines of data
95
+ on the display. If you provide a single color, all lines will be that color. Otherwise
96
+ it will cycle through the list you provide if the list is less than the number of lines
97
+ displayed. Default colors are used if ``colors`` is not set. For example, if creating
98
+ two lines of data, ``colors=((255, 255, 255), (255, 0, 0))`` would set the first line
99
+ white and the second line red, and if you created four lines of data with the same
100
+ setup, it would alternate white and red. You can also use the colors built into the
101
+ library. For example, if you import the library as
102
+ ``from adafruit_simple_text_display import SimpleTextDisplay``, you can indicate the
103
+ colors as follows: ``colors=(SimpleDisplayText.WHITE, SimpleDisplayText.RED)``.
104
+ :param None,~displayio.Display display: The display object. Defaults to assuming a built-in
105
+ display. To use with an external display, instantiate the display object and provide it
106
+ here. Defaults to ``board.DISPLAY``.
111
107
112
108
This example displays two lines with temperature data in C and F on the display.
113
- Remember to call `` show()` ` after the list to update the display.
109
+ Remember to call `show()` after the list to update the display.
114
110
115
111
.. code-block:: python
116
112
@@ -149,9 +145,7 @@ def __init__( # pylint: disable=too-many-arguments
149
145
if display is None :
150
146
display = board .DISPLAY
151
147
self ._display = display
152
- self ._font = terminalio .FONT
153
- if font :
154
- self ._font = font
148
+ self ._font = font if font else terminalio .FONT
155
149
156
150
self .text_group = displayio .Group (scale = text_scale )
157
151
0 commit comments