Skip to content

Commit

Permalink
Merge pull request #50 from haugenmitch/update-display_text-documenta…
Browse files Browse the repository at this point in the history
…tion

Update font documentation for display_text()
  • Loading branch information
tannewt authored Nov 9, 2023
2 parents 58115aa + 7805935 commit 8c8c297
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions adafruit_macropad.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,21 +899,24 @@ def display_text(
Defaults to 80.
:param int text_scale: Scale the size of the data lines. Scales the title as well.
Defaults to 1.
:param font: The font or the path to the custom font file to use to display the text.
Defaults to the built-in ``terminalio.FONT``. Custom font files must be
provided as a string, e.g. ``"/Arial12.bdf"``.
:param ~FontProtocol|None font: The custom font to use to display the text. Defaults to the
built-in ``terminalio.FONT``. For more details, see:
https://docs.circuitpython.org/en/latest/shared-bindings/fontio/index.html
The following example displays a title and lines of text indicating which key is pressed,
the relative position of the rotary encoder, and whether the encoder switch is pressed.
Note that the key press line does not show up until a key is pressed.
.. code-block:: python
from adafruit_bitmap_font import bitmap_font
from adafruit_macropad import MacroPad
from displayio import Bitmap
macropad = MacroPad()
text_lines = macropad.display_text(title="MacroPad Info")
custom_font = bitmap_font.load_font("/Arial12.bdf", Bitmap)
text_lines = macropad.display_text(title="MacroPad Info", font=custom_font)
while True:
key_event = macropad.keys.events.get()
Expand Down

0 comments on commit 8c8c297

Please sign in to comment.