Skip to content

Commit 8c8c297

Browse files
authored
Merge pull request #50 from haugenmitch/update-display_text-documentation
Update font documentation for display_text()
2 parents 58115aa + 7805935 commit 8c8c297

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

adafruit_macropad.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -899,21 +899,24 @@ def display_text(
899899
Defaults to 80.
900900
:param int text_scale: Scale the size of the data lines. Scales the title as well.
901901
Defaults to 1.
902-
:param font: The font or the path to the custom font file to use to display the text.
903-
Defaults to the built-in ``terminalio.FONT``. Custom font files must be
904-
provided as a string, e.g. ``"/Arial12.bdf"``.
902+
:param ~FontProtocol|None font: The custom font to use to display the text. Defaults to the
903+
built-in ``terminalio.FONT``. For more details, see:
904+
https://docs.circuitpython.org/en/latest/shared-bindings/fontio/index.html
905905
906906
The following example displays a title and lines of text indicating which key is pressed,
907907
the relative position of the rotary encoder, and whether the encoder switch is pressed.
908908
Note that the key press line does not show up until a key is pressed.
909909
910910
.. code-block:: python
911911
912+
from adafruit_bitmap_font import bitmap_font
912913
from adafruit_macropad import MacroPad
914+
from displayio import Bitmap
913915
914916
macropad = MacroPad()
915917
916-
text_lines = macropad.display_text(title="MacroPad Info")
918+
custom_font = bitmap_font.load_font("/Arial12.bdf", Bitmap)
919+
text_lines = macropad.display_text(title="MacroPad Info", font=custom_font)
917920
918921
while True:
919922
key_event = macropad.keys.events.get()

0 commit comments

Comments
 (0)